It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket Server Base URL

Michael Husted Aug 26, 2018

Greetings! Whenever I log into my Bitbucket instance behind an Apache reverse proxy for SSL, Bitbucket thinks I'm using the localhost:7990 URL, when I'm not (it says base URL does not match current URL). I'm using https://code.greem.me - Any help on this would be appreciated!
Currently I'm using an evaluation license, but I've sent in an open source request.

Some extra info:
SSL CA: Let's Encrypt - Wildcard SSL valid for *.greem.me

Bitbucket Server Version: 5.13.1

I can attach my VirtualHost if needed.

 

1 answer

1 accepted

1 vote
Answer accepted
Alexis Robert Community Leader Aug 26, 2018

Hello @Michael Husted

 

you should be able to simply update the Base URL in your BitBucket configuration as described here.

 

Let me know if this helps, 

 

--Alexis

Michael Husted Aug 26, 2018

Still gives the error. Let me try resetting my cache.

Michael Husted Aug 26, 2018 • edited

Yep, still says it. Could it be because the reverse proxy is accessing localhost, so it thinks I am too? The Bitbucket header image directs me to localhost as well. It gives me localhost when I make a branch as well. (the part where it says to push code/whatever has localhost:7990 there instead of code.greem.me.)

Alexis Robert Community Leader Aug 26, 2018

ok so it might be because of your reverse proxy configuration, what does your vhost look like ?

Michael Husted Aug 26, 2018

here is a link to a gist with my VHosts in it.

Alexis Robert Community Leader Aug 26, 2018 • edited

You just need to change these 2 lines:

 

ProxyPass / http://localhost:7990/ 
ProxyPassReverse / http://localhost:7990/

 

to the actual bitbucket server IP: 

 

ProxyPass / http://10.0.0.X/ 
ProxyPassReverse / http://10.0.0.X/

 

Michael Husted Aug 26, 2018

wouldn't that create a redirect loop?

Alexis Robert Community Leader Aug 26, 2018

sorry I edited the answer - it should be your bitbucket server IP

Michael Husted Aug 26, 2018

I get this:

 

Michael Husted Aug 26, 2018

and this with nothing after the trailing /

Michael Husted Aug 26, 2018

Changed it to my server's public-facing IP, that somewhat resolved the issue. Is there anyway I could redirect my raw IP:port -> my domain?

Alexis Robert Community Leader Aug 26, 2018

you mean like when you type 192.168.0.1:7990 it would redirect to mydomain.com ? I don't think that's possible unless you play with redirects, like this:

 

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]
Michael Husted Aug 26, 2018

Wouldn't I need to have apache listen on that port? Or could I make a RegEx for it?

Michael Husted Aug 26, 2018

@Alexis RobertThe primary issue I'm having is that it's showing the IP:Port when creating a new repository. Also the Bitbucket header has it too.

Christian Glockner Atlassian Team Aug 26, 2018

Hi Evan,

The URL used in those links is the URL configured as the Base URL.

Additionally, did you set the reverse proxy information in bitbucket.properties?

Cheers,

Christian

Premier Support Engineer

Atlassian

Michael Husted Aug 26, 2018

The base URL is https://code.greem.me, that's odd. What would I need to add to the properties file? I was looking into that earlier but couldn't find anything.

Michael Husted Aug 26, 2018

Actually, it's always yelling at me that my Base URL is incorrect.

Screenshots:

 

Michael Husted Aug 26, 2018

@Christian GlocknerI appreciate your help! @Alexis Robert you too :^)

Christian Glockner Atlassian Team Aug 27, 2018

Hi Evan,

 

You'll need to add just a few lines to bitbucket.properties as described in step 1 here:

https://confluence.atlassian.com/bitbucketserver/securing-bitbucket-server-behind-nginx-using-ssl-776640112.html#SecuringBitbucketServerbehindnginxusingSSL-Step1:ConfiguretheEmbeddedTomcatConnector

Cheers,

Christian

Premier Support Engineer

Atlassian

Michael Husted Aug 27, 2018

I needed to add

ProxyPreserveHost On

to my VirtualHost to fix it, and set my base url to non-HTTPS. It's working now, thanks!

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,615 views 1 18
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you