Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket fails to authenticate with reverse proxy

Parth Shah August 22, 2017

Hello,

I followed the documentation for using NGINX to reverse proxy to port 80 https://confluence.atlassian.com/bitbucketserver/securing-bitbucket-server-behind-nginx-using-ssl-776640112.html

I was able to get the server up and listening on desired FQDN but was not able to login to the bitbucket.

Directoy - BitBucket Internal Directory

 

Nginx Config - 

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http{
access_log /var/log/nginx/access.log;
server {
listen 80;
server_name X.X.com;

#ssl on;
#ssl_certificate <path/to/your/certificate>;
#ssl_certificate_key <path/to/your/certificate/key>;
#ssl_session_timeout 5m;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_prefer_server_ciphers on;

location /bitbucket {
client_max_body_size 100m;
proxy_pass http://X.X.X.X:7990;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
#proxy_redirect off;
port_in_redirect off;
proxy_redirect http://X.X.X.X:7990/ /bitbucket;
proxy_connect_timeout 300;
}
}
}

 

and the config under bitbucket.properties

 

server.port=7990
server.secure=true
server.scheme=http
server.proxy-port=80
server.proxy-name=bitbucket.ottonet.local
server.context-path=/bitbucket

 

1 answer

1 accepted

0 votes
Answer accepted
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2017

What specifically happens when you try to login?

There are a few items that are different in the nginx configuration from the documentation that's link that might fix the issues you're running into.

"proxy_redirect off;" is commented out, is this for a specific reason?

"server.secure=true" should be set to false or removed since you're not terminating SSL in nginx. Bitbucket Server will need to be restarted for this to take.

In my nginx configuration, I have the following configuration:

 location /bitbucket {
proxy_pass http://192.168.5.10:7990/bitbucket;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
}

Note that I have "/bitbucket" in both the location and proxy_pass. Can you try a more simple configuration like the above and see if it helps in addition to the other changes? 

Parth Shah August 22, 2017

Awesome. Thanks so much!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events