Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Reverse Proxy with Nginx

Siecje September 10, 2015

 I'm trying to setup a reverse proxy so that I can access jira through jira.mydomain.com

On the dashboard the gadgets don't load and I see a banner that says.

"I have added those line exactly (leaving $host as is) in the location / { section.

I restarted nginx, I can't restart jira. When I go to the page I see the gadgets are not visable and I have a banner that reads "JIRA's base URL is set to http://jira.mydomain.com but you are accessing JIRA from http://jira.mydomain.com."

 

nginx conf

server {
    server_name jira.mydomain.com;
    #to allow large uploads (eg: for restoring backups)...
    client_max_body_size 100M;
    location / {
        proxy_pass http://localhost:8080;
    }
}

server.xml

<Service name="Catalina">

        <Connector port="8080"

                   maxThreads="150"
                   minSpareThreads="25"
                   connectionTimeout="20000"

                   enableLookups="false"
                   maxHttpHeaderSize="8192"
                   protocol="HTTP/1.1"
                   useBodyEncodingForURI="true"
                   redirectPort="8443"
                   acceptCount="100"
                   disableUploadTimeout="true"
                   
                   scheme="http"
                   proxyHost="jira.mydomain.com"
                   proxyName="jira.mydomain.com"
                   proxyPort="80"
        />

 

JIRA will not start.

sudo service jira start

If I view the dashboard the widgets say "Unable to connect"

In the logs I see "Detected URL hostname, 'localhost', does not match expected hostname 'jira.mydomain.com'

Where does the 'localhost' come from?

2 answers

1 vote
David Di Blasio
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2015

Hi Cody, 

Try adding the following headers to your nginx connector config and see if it helps. 

 

        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;
Siecje September 11, 2015

I added it and restarted nginx but no change.

0 votes
Giuliano C_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 10, 2015

Hi Cody, 

 

There's some JIRA docs that could help you on this matter. For example, if you take a look at this article you will see that the cause could be related to the Apache server not identifying the current host to be redirected. Also, I could find some related Answers posts that could be kindly related to your situations. Some suggesting to add a ProxyPreserveHost On in the Apache Virtual host and others related to make the proxy reverse value to be "off".

 

These examples came from the following answers:

 

https://answers.atlassian.com/questions/25460

https://answers.atlassian.com/questions/16218

 

Hope it helps you, sir!

 

Cheers, 

Giu

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events