Why do I receive a "connection refused" error after setting the base URL?

riotheitpro May 7, 2017

I have just set up a new Bitbucket instance and changed the base URL. I have been able to access the server admin UI via localhost and from a remote machine:

http://localhost:7990
http://<computer_name>:7990

However, I need to access the Bitbucket instance via the URL:
http://bitbucket.<doman_name>.<tld>:7990

When I attempt to access the web UI via the new base URL, Chrome returns a "connection refused" error, however this does not occur when I use the computer name. Do I need to edit a Tomcat configuration file to allow for the new base URL? I wouldn't think so as I've been able to update the base URL for JIRA and Confluence (separate VMs) without incident.

1 answer

1 vote
Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

You shouldn't need to configure anything within Bitbucket Server for the http://bitbucket.<doman_name>.<tld>:7990 URL to work. The connection refused message suggests that the URL above is not pointed to the correct server. 

If you run dig or ping to bitbucket.<doman_name>.<tld>, do you get a response and is it pointed at the correct IP address?

riotheitpro May 30, 2017

Pinging the domain returns the correct IP address as does an nslookup. One would think that if the URL was not pointed to the correct server then it would return a 404 error, as there wouldn't be a URL endpoint configured to accept requests to that URL.

What config file does BitBucket Server edit to specify the URL endpoint? I can manually edit a configuration file if needed. Alternatively, is there a way I can manually re-run the setup process?

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

What is the result of running the following:

curl -iL http://bitbucket.domain.tld:7990

Are there any firewalls in place that would be blocking the request? Since you can hit this from a remote machine using the computer name on port 7990, this seems less likely, but worth checking.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

The base URL setting is stored in the DB, but this should not be causing a connection refused message.

riotheitpro May 30, 2017

The curl result against the desired base URL:

curl: (7) Failed to connect to bitbucket.<domain>.<tld> port 7990: Connection 

I know it's to do with the Tomcat instance because I can access the web UI just fine if I use the machine's FQDN. For reference, the machine is on an AD domain and I have pin-point DNS running to have DNS records on their external domain resolving internally. Is there an option in the server.properties file that I can use to specify an alias for Tomcat to accept queries on?

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

By default Bitbucket Server binds to 7990 and does not care which address you use to connect on port 7990. You can configure 'address="192.168.10.10"' to bind to a specific IP address, if multiple are available. If a reverse proxy is being used, proxyPort="80" and proxyName="mycompany.com" could be set, but no of these would result in the behavior you're seeing. 

If the machine name and bitbucket.domain.tld both resolve to the same IP address, then this should all work. The fact that you get a connect refused indicates that there is something amiss with bitbucket.domain.tld and allowing connections through to port 7990.

riotheitpro May 30, 2017

I receive the same connection error when logged into the server hosting the BitBucket application and connecting to http://localhost:7990/ so that rules out a firewall issue (the firewall is disabled in any case but better safe than sorry). There are no reverse proxies being used.

Which configuration file specifies the address that Tomcat binds to? I might update that to listen on all interfaces.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

Since you get the same connection refused message using localhost, but this worked before, what has changed? Can you confirm that Bitbucket Server is still running?

address="192.168.10.10" controls which IP address we'll bind to, but by default, this is not needed.

riotheitpro May 30, 2017

BitBucket Server is running.

If I browse to http://<machinename>.internal.<domain>.<tld>:7990 I get the logon page, both on the host server and a remote machine.

If I browse to http://localhost:7990 I get a connection refused error.

If I browse to http://bitbucket.<domain>.<tld>:7990 I get a connection refused error.

The firewall is off and the DNS records are pointing to the correct IP address; 192.168.0.43 in this case. I have not exposed the BitBucket server to the outside world as yet, and Active Directory has the required DNS zones so that the DNS zones resolve to the correct locations.

Jeff Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2017

There has to be something that we're missing. If you'd like, I'd be happy to look at it together. Just shoot me a message at jethomas at atlassian dot com and we can set up a time to chat.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events