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 behind apache ssl reverse proxy not allowing branch creation

I've just installed Bitbucket on my local server and configured it behind an apache reverse proxy. Bitbucket is working but the branch creation does not work. If I access directly using the :7990 port the branch creation works so it's definitely linked to the reverse proxy configuration.

In my server.xml I have:

<Connector port="7990" protocol="HTTP/1.1"
                   compression="off"            compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript" />
                   proxyPort="443" />

but in my server config requires me to enter the baseUrl as '' rather than '' which otherwise it gives me the banner saying my base url config is not correct. This change to http and compression is turned off was recommended in other forum answers.

Anyone any ideas? There must be something I've missed that's causing this. I've not tested pull requests etc so expect that it may not be simply branches that are not working correctly.


3 answers

0 votes
Timothy Chin Community Leader Jan 08, 2017

https should be the right baseUrl. Also check if you have forced redirect of port 80 to 443 in your Apache configuration.

The issue is that if I put https:// in the baseUrl I get the warning that it's not the right URL when accessing it via HTTPS. I also have a redirect on the non secure URL (port 80) as follows:

Redirect /

So all should be fine.

0 votes
Daniel Wester Community Leader Jan 08, 2017

There's more than likely an issue with your apache configuration. Can you paste in the configuration that you have?

The apache config on SSL is as follows:

ErrorLog /var/log/virtualmin/bitbucket.mydomain.com_error_log
CustomLog /var/log/virtualmin/bitbucket.mydomain.com_access_log combined
SSLEngine on
SSLCertificateFile /home/bitbucket/ssl.cert
SSLCertificateKeyFile /home/bitbucket/ssl.key
SSLCACertificateFile /home/bitbucket/
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
ProxyPreserveHost On
ProxyPass / http://localhost:7990/
ProxyPassReverse / http://localhost:7990/

And on port 80 is:

DocumentRoot /home/bitbucket/public_html
ErrorLog /var/log/virtualmin/bitbucket.mydomain.com_error_log
CustomLog /var/log/virtualmin/bitbucket.mydomain.com_access_log combined
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/bitbucket/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
Redirect /

What I do see is when the branch create is clicked that there is a POST request to the server that is rejected with a 403 response:

[09/Jan/2017:08:40:39 +0000] "POST /rest/branch-utils/latest/projects/COM/repos/com/branches HTTP/1.1" 403 488 "" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12"

so yes looks like it's something in the config between Apache and bitbucket. Any help appreciated.


Fixed this - the issue was the Connector element in the server.xml - a stray closing angle bracket was above the proxy settings '/>'

Can't believe I missed that!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

426 views 0 9
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