JIRA behind nginx proxy: stalling file uploads

Deleted user August 31, 2011

Hi

So far I've contacted Atlassian support and they told me that this issue is out of their scope and referred to answers.atlassian.com. Anyhow, I've an nginx server which acts as the proxy in front of JIRA, everything works fine (and fast), except file uploads.

When uploading avatars (for users/projects) the file uploads are fine, the only problem is with the "fancier" file uploads with the progress bars (in "Attach File(s)..." Dialog). They are stalling for about ~1 minute, so when a file is chosen in the file chooser, the progress bar starts (as expected), then at about ~95% it stops and sits there for ~1 minute, after that Minute the preview appears and the file can be attached...

Here's an example output of nginx logs file:

x.y.z.w - - [31/Aug/2011:15:19:22 +0200] "POST /jira/rest/internal/1.0/AttachTemporaryFile?filename=Screen+Shot+2011-08-29+at+11.08.25.png&size=37008&atl_token=1234-5678-K64L-WF0R%7Clin&issueId=10000 HTTP/1.1" 201 76 "https://abc.example.com/jira/browse/AB-1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.865.0 Safari/535.2" "-"

It looks like the headers are returned and the status code 201 created is returned, when looking at the chrome console I can see, that this POST request is started and also gets the headers back, but then waits for the JSON body response for that minute. Heres my nginx config:

# atlassian jira
upstream srv_jira {
server abcdef:8091;
}

# redirect jira
location ^~ /jira {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host hq.at-point.ch:443;
proxy_set_header X-Forwarded-Proto https;
proxy_pass https://srv_jira;<a< a=""> href="https://srv_jira;">
}

Am I missing an important proxy_... setting, or has anyone observed similar behaviour when using nginx as a proxy for jira?

4 answers

1 accepted

2 votes
Answer accepted
Michael Andreacchio
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2012

Hey guys,

Just for completeness here is the fix that was given in the support ticket:

This is not a supported fix and it is out of the scope for supporters to troubleshoot proxy problems so this fix may help but we cannot gurantee it, it has been recently untested and it is not something in the pipeline unfortunately.

We suspect the problem could be because Nginx is pretty strict about the return types - perhaps 401 should not have a body, or perhaps it could be because it uses http1.0.

This is the change set that we recommend:

Index: jira-components/jira-webapp/src/main/webapp/includes/ajs/attachment/InlineAttach.js
===================================================================
--- jira-components/jira-webapp/src/main/webapp/includes/ajs/attachment/InlineAttach.js (revision 162082)
+++ jira-components/jira-webapp/src/main/webapp/includes/ajs/attachment/InlineAttach.js (revision )
@@ -46,12 +46,8 @@
      */
     init: function (element) {
         var $element = AJS.$(element);
-        if (AJS.InlineAttach.AjaxPresenter.isSupported($element)) {
-            new AJS.InlineAttach.AjaxPresenter($element);
-        } else {
-            new AJS.InlineAttach.FormPresenter($element);
-        }
+        new AJS.InlineAttach.FormPresenter($element);
+    }
-    }
 });

(Remove the lines with the - and add the ones with the +)

After doing this :

  • Clear browser caches
  • Delete the JIRA-install/work directory.
  • Restart your instance.

This fix is not really an easy one, it basically means you will need to change the javascript that you are using. Please let me know if you can do that. Otherwise we will need to check for the possibilities at our end.

Since we tested specifically against apache mod_proxy, can we find out the details of your setup to replicate the problem here and fix the problem for good.

Regards,

Atlassian Support

0 votes
Ken Sheppardson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 30, 2012

Lukas: Is there any chance you could pass along or post the JavaScript Atlassian gave you? I just logged this same issue in a support ticket with them, and their response was simply "At this time, we do not have a fix listed in our JIRA. I have taken the liberty to log a Feature Request on your behalf."

0 votes
Deleted user December 5, 2011

closing question, atlassian support gave me some updated javascript files as a workaround for this issue.

Martin Buchleitner June 20, 2012

Which version is affected at your installation?

Deleted user June 20, 2012

Guess it was the JIRA Enterprise 4.0.1 Standalone edition.

Martin Buchleitner June 20, 2012

Thanks - it seems to be already built into 5.0.3 :)

0 votes
Dennis Kromhout van der Meer
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.
December 4, 2011

Be sure to add proxyName and proxyPort to your Tomcat server.xml. You can try to modify server.xml as follows:

{noformat}
<Connector
...........
proxyName="srv_jira" proxyPort="443"/>
{noformat}

Good luck!

Deleted user December 5, 2011

thanks, in fact only AJAX Request are troubled - I've contact Atlassian Support and they gave me a fix to disable the AJAX call in this special case. though, the root issue is not solved.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events