api-platform: Error 502 on some api routes "upstream sent too big header while reading response header from upstream"
Hello,
i’ve got 502 errors on some routes of my api on my dev machine running api-platform on docker.
The logs shows this :
api | 2018/11/12 13:14:09 [error] 7#7: *6 upstream sent too big header while reading response header from upstream, client: 172.18.0.2, server: , request: "GET /v2/contact_functions HTTP/1.1", upstream: "fastcgi://172.19.0.4:9000", host: "api.test:8000", referrer: "http://api.test:8000/"
api | 172.18.0.2 - - [12/Nov/2018:13:14:09 +0000] "GET /v2/contact_functions HTTP/1.1" 502 559 "http://api.test:8000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36" "172.18.0.1"
I’m not sure I get what’s wrong, it looks like it’s an nginx error. Can we add configs (it looks like fastcgi_buffers / fastcgi_buffer_size could help). Or is there a way to control these headers ?
On some other working routes, I can see a lot of informations under Cache-Tags Headers, could it be the problem ? Again, can I do something on these headers ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 23 (11 by maintainers)
@purplefish32
This worked for me (
api/docker/nginx/conf.d/default.conf) :fastcgi_busy_buffers_sizedoes not exists for fastcgiBy the way, thank you all for your help !
What you’re looking for is fastcgi_buffer_size and friends.
This guide seems helpful: https://gist.github.com/magnetikonline/11312172
@janklan I can kiss you!! Thank you very much!
I am coming here from a strange Heroku issue: fetching 59 items from api platform works, but fetching 60 items I get a strange CORS error in the browser:
... blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource ...Looking in the Heroku PHP logs I only find
Premature end of script headers: index.phpandError parsing script headersOn Heroku there is no way to increase the Header Size. Thus, the headers have to be limited programatically.
Please Note: I had to update the first parameter of the
onKernelResponsewith aResponseEventI was having this problem but only on the https version of the api (port :8443). To fix it I had to increase the buffer size of the h2-proxy (editing the file
./h2-proxy/conf.d/default.conf). Like this:Indeed we should change the default value, and add a section here: https://api-platform.com/docs/extra/troubleshooting/#troubleshooting
I think we could probably ship with a better default out of the box. 😄