Alexander Kim Alexander Kim - 1 month ago 36
Java Question

Haproxy config for bitbucket server

I am using haproxy for port forwarding to Bitbucket server ssh. Here's haproxy config:

frontend sshd
bind *:7999
default_backend ssh
timeout client 1h

backend ssh
mode tcp
server localhost-bitbucket-ssh 127.0.0.1:7999 check port 7999


However if i do:

sudo haproxy -f haproxy.cfg


i am getting the following error:

[ALERT] 305/201411 (4168) : http frontend 'sshd' (haproxy.cfg:38) tries to use incompatible tcp backend 'ssh' (haproxy.cfg:43) as its default backend (see 'mode').
[ALERT] 305/201411 (4168) : Fatal errors found in configuration.


But i was referring to an official atlassian guide: https://confluence.atlassian.com/bitbucketserver/setting-up-ssh-port-forwarding-776640364.html are they wrong?

Also if i start haproxy before bitbucket server, bitbucket server cannot start on port 7999. I am totally confused. I have paid for that software and now i need to figure it out myself how to configure it for more than 2 days...

UPDATE

It was UFW as Thomj mentioned. But for what purposes do i need haproxy? If i can't bind Bitbucket's ssh to 22 port? I don't like to set port number.

Answer

The frontend configuration is defaulting to a mode of http which can't use a backend that's configured for tcp. Try adding 'mode tcp' to the frontend:

frontend sshd
        bind *:7999
        default_backend ssh
        timeout client 1h
        mode tcp