Bitbucket: Base URL Mismatch

I have Bitbucket 4.12.0 running fine without SSL.  I've now put it behind an Nginx reverse proxy and followed the instructions.  Here's my BITBUCKET_HOME/shared/bitbucket.properties server section:

server.port=7990
server.secure=true
server.scheme=https
server.proxy-port=443
server.redirect-port=443
server.proxy-name=my.domain.com
server.context-path=/

server.proxy-name matches that in the admin baseUrl settings.

The nginx config is this:

server {
    listen 80;
    server_name my.domain.com;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {

    listen 443 ssl;
    server_name my.domain.com;

    ssl on;
    ssl_certificate "/etc/certs/my.domain.com/fullchain.pem";
    ssl_certificate_key "/etc/certs/my.domain.com/privkey.pem";
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
    #ssl_ecdh_curve secp384r1;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;
    ssl_stapling on;
    ssl_stapling_verify on;

    location / {
        proxy_pass          http://localhost: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      http://localhost:7990 https://my.domain.com;
#       proxy_redirect  off;
    }
  }

Setting proxy_redirect off; causes a failure to subit forms on the site (as .  The line that is in does not.

Despite all this, the BitBucket icon at top left still inks to http://localhost:7990  and I get the red banner at the top with the 'You are accessing Bitbucket from a URL that does not match the configured base URL. You may want to change it.' message.

The instructions are slightly confusing, as I was expecting to have to have a server.xml file, but replacing the bitbucket.properties with server.xml meant bitbucket wouldn't even start.

I can see that this sort of question has been asked before, but nothing I've seen so far has helped.

TIA

1 answer

0 votes
Ben Stuart Atlassian Team Jan 25, 2018

Hey Ashley, It looks like you're using the instructions for Bitbucket 5.0+ after we switched to Spring Boot. For 4.12 you should still be using the server.xml per our instruction here:

https://confluence.atlassian.com/bitbucketserver0412/securing-bitbucket-server-behind-nginx-using-ssl-869179697.html

Give that a try and hopefully it works. :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,909 views 7 10
Read article

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