Issue
I have an ajax form that will post multiple files to a server. The submission works with one or two files, but adding more will trigger a timeout error, and I can't figure out where it's coming from.
I've looked at everything I can think of to see if there's a default setting in one of my plugins to no avail.
I'm not sure what information will be helpful in resolving this, so I'll tell as much as I know. Let me know if you need to see anything I'm not showing.
Details
I'm using this approach to serialize the file data: Sending multipart/formdata with jQuery.ajax
I have two servers. An Express server at :3000 to handle presentational data, and a Hapi server at port :3001 to handle database transactions and backend logic. In between those, I'm using http-proxy to send requests from localhost:3000/api to localhost:3001/api.
Then... I have this hosted on an Apache centOS server. From there, www.url.com is mapped to localhost:3000.
-----------
| browser |
-----------
|
[jQuery AJAX POST]
|
v
------------------- ------------------------------------
| www.url.com/api | --[Apache ProxyPass]--> | localhost:3000/api (express app) |
------------------- ------------------------------------
|
[node/express http-proxy]
|
v
---------------------------------
| localhost:3001/api (hapi api) |
---------------------------------
According to the logs, it never makes it to the api. I can log a successful connection on the express server, but then I get a timeout error after about 11-12 seconds.
I'm led to believe it's an issue somewhere with express or http-proxy, but I can't figure out where.
Failed Attempts
- I've tried setting jQuery ajax timeout to 10 minutes, and alternatively having no timeout at all.
- I've tried setting apache timeout to 60 minutes via httpd.conf file.
- I've tried setting a timeout on the http-proxy middleware, then started seeing 502 gateway errors.
Error
POST
http://#############/api/new-request 408 (Request Timeout)
Q.cors.e.crossDomain.send @ vendor.min.js:26
Z.extend.ajax @ vendor.min.js:25
e @ evaluate-risk:2s @ vendor.min.js:55
(anonymous function) @ vendor.min.js:55
Z.event.dispatch @ vendor.min.js:25
m.handle @ vendor.min.js:24
evaluate-risk:2 Object {readyState: 4, responseText: "{"statusCode":408,"error":"Request Timeout"}", responseJSON: Object, status: 408, statusText: "Request Timeout"}abort: (e)always: ()complete: ()done: ()error: ()fail: ()getAllResponseHeaders: ()getResponseHeader: (e)overrideMimeType: (e)pipe: ()progress: ()promise: (e)readyState: 4responseJSON: ObjectresponseText: "{"statusCode":408,"error":"Request Timeout"}"setRequestHeader: (e,t)state: ()status: 408statusCode: (e)statusText: "Request Timeout"success: ()then: ()__proto__: ObjectjQuery.ajax.error @ evaluate-risk:2c @ vendor.min.js:24f.fireWith @ vendor.min.js:24n @ vendor.min.js:25(anonymous function) @ vendor.min.js:26