Bitbucket fails to authenticate with reverse proxy Edited

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 vote
Jeff Thomas Atlassian Team Aug 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? 

Awesome. Thanks so much!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

27,615 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you