After setting up Nginx to proxy to JIRA, none of my assets (CSS, JS or images) load

Martin Sweeny September 16, 2016

This question is in reference to Atlassian Documentation: Integrating JIRA with Nginx

I set up the Nginx proxy as described here.

When I go to JIRA, anything at <base url>/s/ seems not to load. Most of the application's assets like CSS, JS and images seem to be found at this path.

Accessing JIRA directly, bypassing the proxy, works fine.

If I follow the URL of the assets (for example using the Networks tab of Chrome's debugging tools), I see a JIRA 404 page, rather than nginx.

My configurations:

&lt;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"
                   proxyName="&lt;domain&gt;"
                   proxyPort="80"/&gt;
server {
    listen &lt;domain&gt;:80;
    server_name &lt;domain&gt;;
    location /jira {
        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;
        proxy_pass http://localhost:8080/jira/;
        client_max_body_size 10M;
    }
}

Where <domain> is the domain at which I wish to access JIRA

5 answers

1 accepted

1 vote
Answer accepted
Martin Sweeny September 16, 2016

I checked out my access logs for JIRA, located at /opt/atlassian/jira/logs/ which showed me requests similar to "GET /jira//s/d41d8cd98f00b204e9800998ecf8427e-CDN/[...]" - there is an extra slash by /jira//

So double-checking my nginx and JIRA config shows the only trailing slash - in the nginx config.

Changing proxy_pass http://localhost:8080/jira/ to proxy_pass http://localhost:8080/jira fixed it for me.

Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2016

Whoo! Thanks for providing your solution! I've definitely done that before myself. >_<

Martin Sweeny September 16, 2016

Yeah, I think I had found some results that were similar but not exactly like my resolution. In particular, there is an Atlassian documentation that specifies how to fix that extra slash on the JIRA Tomcat server, but not if it's coming from nginx. Anyway, thought it might be useful!

1 vote
simonmijares November 30, 2017

I had this issue as well, but checking the configuration file I forgot to comment the followind lines:

 

 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#}

 and

#location = /favicon.ico { log_not_found off; access_log off; }
#location = /robots.txt { log_not_found off; access_log off; allow all; }
#location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
# expires max;
# log_not_found off;
#}

After that it stared to work

Roboo August 5, 2018

Thanks Simon, this fixed my issue :)

0 votes
Victor Chirita February 16, 2017

For me changing the proxy_pass directive did not solve the issue.

Here's my nginx.conf

location /jira {

                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;
                proxy_pass http://192.168.0.110:8081/jira;
                client_max_body_size 10M;

            }

 

and the error I get when accessing: http://192.168.0.110/jira/secure/Dashboard.jspa

 

http://192.168.0.110/s/26affc4f16c905f5f1f17026cd70afa4-CDN/3pc49q/73012/b6b48b2829824b869586ac216d119363/36bdaebd89070ad4ecdd9b63c8a47c95/_/download/contextbatch/css/_super/batch.css

not found.

 

However, I think it's a nginx config issue, but I don't manage to solve it.

 

Mystech Support February 21, 2017

Do you also have Wordpress installed?

0 votes
Martin Sweeny September 16, 2016

Updated the question with config details

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2016

Can you share your configuration details?

Suggest an answer

Log in or Sign up to answer