Convox Community

Getting 502 Bad Gateway errors for one page on v3 rack. App responds with 200, and the page works fine on v2 rack

I’ve almost completed the v2 => v3 upgrade, but now I’m stuck on one last problem. Convox / K8s is returning a 502 error for my app’s homepage (and only the homepage.) Everything else works fine and returns 200 response (health checks, app pages, sign in page, etc.)

I can also see the 200 response in the logs, but openresty seems to have a problem with my homepage, and is dropping the 200 response and returning a 502. This isn’t happening with v2 racks, it’s only happening on v3. (I’m running an identical application on both v2 and v3 as a practice run for the migration.)

I can’t find any more detailed logs to show why this is happening. The only thing I can think of is that my home page includes a lot of preload “link” headers. Maybe this isn’t supported and is causing an error?

There should be no issues with the response time. It only takes 40ms for the application to return a response. Other pages are slower but still working fine.

So my hunch was correct… openresty doesn’t like these link headers with rel=preload, so it drops my 200 response and returns a 502 Bad Gateway error:

I removed these link headers and the page loads fine. Reverted the change, and the 502 Bad Gateway error is back. (Just to triple-check that this was definitely the issue.)

I have this page proxied through CloudFlare to use their HTTP/2 Server Push feature: HTTP/2 Server Push Service | Cloudflare

My web server (puma) doesn’t actually support HTTP/2, so I was just using CloudFlare to detect the headers and push the assets to the client.

Is there any workaround for this, or could anyone point me towards some documentation? Thanks!