Welcome! Log In Create A New Profile

Advanced

Error when uploading files to Jira through Nginx

Posted by thg 
thg
Error when uploading files to Jira through Nginx
August 14, 2015 03:50AM
Hi,

We are running Nginx in front of several of our different webpages/services. Among others Jira is one of them. We are now facing a problem when trying to upload larger files to Jira. In Jira the default attachments size is 10MB. I have raised that to 100MB. In Nginx config I added this line:

"client_max_body_size 100M;"

What happens is that I am somehow able to upload files up to 19,99MB but not above. Strange?! When trying with files larger than 20MB, I get the following error:

"Cannot attach file [filename]. Browser made bad request to the server"

To avoid any timeout issues I then added the following lines to Nginx config:

proxy_connect_timeout 300000;
proxy_send_timeout 300000;
proxy_read_timeout 300000;
send_timeout 300000;

No changes I am afraid.

Here is my entire Nginx Jira config:

server {
listen 80;
server_name jira.company.com;
location / {
proxy_set_header Host $host;
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://servername:8080;
client_max_body_size 100M;
proxy_connect_timeout 300000;
proxy_send_timeout 300000;
proxy_read_timeout 300000;
send_timeout 300000;
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; (this parameter made no difference here)
}
}

And here is my Jira server.xml:

<Connector port="8080"

maxThreads="150"
minSpareThreads="25"
maxSpareThreads="75"
connectionTimeout="20000"
enableLookups="false"
maxHttpHeaderSize="8192" (I have tried raising this default number too, but no changes)
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="100"
disableUploadTimeout="true"
SSLEnabled="false"
scheme="https"
secure="true"
proxyName="jira.company.com"
proxyPort="443"
/>

To verify that "client_max_body_size" parameter is working on my server at all, I changed that parameter for another webservice and it worked.

If I bypass the Nginx server, files are uploaded to Jira as they are supposed to.

Has anyone ancountered anything similar? I have been running this problem back and forth with Atlassian support but it seems they have given up and beleive Nginx is the source of the error and I can not really blame them for thinking so.


Any help appreciated!

Cheers
thg
Re: Error when uploading files to Jira through Nginx
August 14, 2015 05:07AM
Could be a corrupt cookie, also see this one:
http://stackoverflow.com/questions/12315832/how-to-fix-nginx-throws-400-bad-request-headers-on-any-header-testing-tools

---
nginx for Windows http://nginx-win.ecsds.eu/
thg
Re: Error when uploading files to Jira through Nginx
August 14, 2015 08:08AM
My error log shows this:

2015/08/14 13:30:10 [warn] 12324#13008: *11662613 an upstream response is buffered to a temporary file D:\nginx-1.7.10/temp/proxy_temp/6/94/0000763946 while reading upstream, client: 194.143.xx.xx, server: jira.company.com, request: "GET /browse/TP-12?jql=project%20%3D%20TP HTTP/1.1", upstream: "http://10.202.xx.xx:8080/browse/TP-12?jql=project%20%3D%20TP", host: "jira.company.com", referrer: "http://jira.company.com/browse/TP/?selectedTab=com.atlassian.jira.jira-projects-plugin:issues-panel"

2015/08/14 13:30:11 [warn] 12324#13008: *11662623 an upstream response is buffered to a temporary file D:\nginx-1.7.10/temp/proxy_temp/7/94/0000763947 while reading upstream, client: 194.143.xx.xx, server: jira.company.com, request: "GET /s/f955e2d5ea267cbc5de89cb14f4a43d8-T/en_USlqfswo/6340/7/d8cf64d54c5fb496833880627476b2a6/_/download/contextbatch/js/jira.navigator.simple,jira.navigator.advanced,jira.view.issue,atl.general,jira.navigator.kickass,jira.global/batch.js?locale=en-US&user-logged-in=true&isAdmin=true HTTP/1.1", upstream: "http://10.202.xx.xx:8080/s/f955e2d5ea267cbc5de89cb14f4a43d8-T/en_USlqfswo/6340/7/d8cf64d54c5fb496833880627476b2a6/_/download/contextbatch/js/jira.navigator.simple,jira.navigator.advanced,jira.view.issue,atl.general,jira.navigator.kickass,jira.global/batch.js?locale=en-US&user-logged-in=true&isAdmin=true", host: "jira.company.com", referrer: "http://jira.company.com/browse/TP-12?jql=project%20%3D%20TP"

2015/08/14 13:30:32 [info] 12324#13008: *11662698 client closed connection while waiting for request, client: 194.143.xx.xx, server: 0.0.0.0:80

2015/08/14 13:30:33 [warn] 12324#13008: *11662622 a client request body is buffered to a temporary file D:\nginx-1.7.10/temp/client_body_temp/0000763948, client: 194.143.xx.xx, server: jira.company.com, request: "POST /rest/internal/1.0/AttachTemporaryFile?filename=Confluence_5_6_CompleteGuide.pdf&size=18415339&atl_token=BKO3-OYXD-ZYN5-P5XU%7C60341efb084bd20ae340ba7d20c6baabcc94b106%7Clin&formToken=b906446fa0cd24d70cd26c788a0fbdc84519adfe&issueId=15440 HTTP/1.1", host: "jira.company.com", referrer: "http://jira.company.com/browse/TP-12?jql=project%20%3D%20TP"

2015/08/14 13:30:40 [info] 12324#13008: *11662703 client closed connection while waiting for request, client: 194.143.xx.xx, server: 0.0.0.0:80

2015/08/14 13:30:45 [info] 12324#13008: *11662708 client closed connection while waiting for request, client: 194.143.xx.xx, server: 0.0.0.0:80

2015/08/14 13:30:48 [warn] 12324#13008: *11662620 an upstream response is buffered to a temporary file D:\nginx-1.7.10/temp/proxy_temp/9/94/0000763949 while reading upstream, client: 194.143.xx.xx, server: jira.company.com, request: "GET /s/f955e2d5ea267cbc5de89cb14f4a43d8-T/en_USlqfswo/6340/7/d8cf64d54c5fb496833880627476b2a6/_/download/contextbatch/js/jira.navigator.simple,jira.navigator.advanced,jira.view.issue,atl.general,jira.navigator.kickass,jira.global/batch.js?locale=en-US&user-logged-in=true&isAdmin=true HTTP/1.1", upstream: "http://10.202.xx.xx:8080/s/f955e2d5ea267cbc5de89cb14f4a43d8-T/en_USlqfswo/6340/7/d8cf64d54c5fb496833880627476b2a6/_/download/contextbatch/js/jira.navigator.simple,jira.navigator.advanced,jira.view.issue,atl.general,jira.navigator.kickass,jira.global/batch.js?locale=en-US&user-logged-in=true&isAdmin=true", host: "jira.company.com", referrer: "http://jira.company.com/browse/TP-12?jql=project%20%3D%20TP"

2015/08/14 13:30:55 [info] 12324#13008: *11662765 client closed connection while waiting for request, client: 194.143.xx.xx, server: 0.0.0.0:80

2015/08/14 13:31:00 [info] 12324#13008: *11662766 client closed connection while waiting for request, client: 194.143.xx.xx, server: 0.0.0.0:80

* I have checked that the D drive has enough free disk space
* The two "client closed connection..." entries refer to the two different legs of our NetScaler

Cheers
thg
Re: Error when uploading files to Jira through Nginx
August 14, 2015 08:24AM
thg Wrote:
-------------------------------------------------------
> My error log shows this:
>
> 2015/08/14 13:30:32 [info] 12324#13008: *11662698 client closed
> connection while waiting for request, client: 194.143.xx.xx, server:
> 0.0.0.0:80

This is a browser(client) action.

> * I have checked that the D drive has enough free disk space

Try without buffering, http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

---
nginx for Windows http://nginx-win.ecsds.eu/
thg
Re: Error when uploading files to Jira through Nginx
August 17, 2015 04:03AM
Tried adding this line but it made no difference. Did I miss something?

proxy_ignore_headers X-Accel-Buffering;
thg
Re: Error when uploading files to Jira through Nginx
August 17, 2015 06:27AM
Also tried proxy_buffering off; but I am still unable to get it to work. Appreciate any help with getting the correct syntax.
Re: Error when uploading files to Jira through Nginx
August 17, 2015 03:56PM
Try doing the client part with curl to exclude any browser issue.

---
nginx for Windows http://nginx-win.ecsds.eu/
thg
Re: Error when uploading files to Jira through Nginx
August 19, 2015 08:34AM
Hi,

Got some help here with cURL and it seems there are no browser issue (I have never used this tool before). My helper also indicated that by being able to upload files <20MB browser issues would not be the case. I am not sure that I really got to disable buffering in Nginx. Would you happen to know the correct syntax?

Cheers
thg
Re: Error when uploading files to Jira through Nginx
August 19, 2015 10:33AM
thg Wrote:
-------------------------------------------------------
> Hi,
>
> Got some help here with cURL and it seems there are no browser issue
> (I have never used this tool before). My helper also indicated that by
> being able to upload files <20MB browser issues would not be the case.

Yes and no, a browser reacts differently then curl, I've seen such cases where firefox times out and curl does not.

> I am not sure that I really got to disable buffering in Nginx. Would
> you happen to know the correct syntax?

Its the documentation link above, but check the logs for buffer messages, which should not be there.

---
nginx for Windows http://nginx-win.ecsds.eu/
thg
Re: Error when uploading files to Jira through Nginx
January 21, 2016 07:24AM
Hi,

A delayed update from my side. I have on and off been looking at this issue but have not found a solution until now. I had not tried upgrading to a newer version of Nginx. I tried the latest version 1.9.9 today and now it works as a charm. Do not ask me how but fixed it is :-)
Thanks for trying to help me out on this one!

Cheers
thg
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready