I have a API First app that has separate servers for the front end and back end.
The frontend is just an NGINX server that serves a static Angular site. The backend is a Play Scala server.
Recently, to avoid having to use CORS anymore, I made anything sent to /api
forward to api.myapp.com
using a block like this:
location /api/ {
proxy_pass https://api.myapp.com/;
}
Everything seems to work fine, except every once in a while the frontend server stops passing requests anymore, and just keeps returning 502s although some requests get through.
If I restart the NGINX server, everything is fine.
If I look at the NGINX logs, I see a bunch of 499 errors for the /api requests.
[15/Jan/2017:22:31:18 +0000] "GET /api/1/users/tzXWM4hNAHUvT9SfA-pAGA/organizations?v=3 HTTP/1.1" 499 0 "https://app.myapp.com/dashboard" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36" "10.225.158.152"
If I look at the backend logs, the requests that return 502 never actually make it to the backend.
Would NGINX be throttling some URLs somehow or thinking the backend server is gone for some reason?
I know in Apache to do something similar I had to set retry=0 for the ProxyPass directive.