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 vote
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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

709 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot