symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
820 stars 297 forks source link

[Live] With nginx and http2, the "Content-Type" header is stripped in a 204 response #543

Closed xaviermarchegay closed 1 year ago

xaviermarchegay commented 1 year ago

Pre-requisites:

Steps:

Technically it is a nginx bug but a 204 response means "no content" so it is confusing to have a content type header when there is none? Moreover nginx does not seem in a hurry to fix it (2 years and counting) so I think it should be fixed in this package. Maybe simply an other header or another way to detect errors?

weaverryan commented 1 year ago

Let’s drop the header during the redirect (which is when we have an empty body) and, instead, add a 2nd header - something custom like X-Live-Redirect. Then, in the javascript, only throw the error of the content-type is wrong/missing AND that special header is missing.

I’d welcome a PR of you’re open to it :)

xaviermarchegay commented 1 year ago

@weaverryan done :)