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

Bitbucket Server Base URL

Michael Husted August 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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 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 August 26, 2018

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

Michael Husted August 26, 2018

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2018

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

Michael Husted August 26, 2018

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

Alexis Robert
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2018

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 August 26, 2018

wouldn't that create a redirect loop?

Alexis Robert
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2018

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

Michael Husted August 26, 2018

I get this:

 

Michael Husted August 26, 2018

and this with nothing after the trailing /

Michael Husted August 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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 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 August 26, 2018

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

Michael Husted August 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
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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 August 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 August 26, 2018

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

Screenshots:

 

Michael Husted August 26, 2018

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

Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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 August 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
TAGS
AUG Leaders

Atlassian Community Events