Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket shim is not getting injected to the response if accept encoding header is present #144

Open
pkvprakash opened this issue Feb 19, 2025 · 1 comment

Comments

@pkvprakash
Copy link

Websocket shim code is not getting injected if Accept-Encoding header is present with the request.

Response when Accept-Encoding header is present with the request:

Image

Response when Accept-Encoding header is not present in the request:

Image
@ojarjur
Copy link
Collaborator

ojarjur commented Feb 22, 2025

My guess is that the response body is being sent back compressed (due to the Accept-Encoding header being set to gzip, deflate, br).

The code in the proxy agent that injects the shim code does not support decompressing/recompressing it, so compressed responses just get sent back as-is.

That is something that we are unlikely to support directly as the added complexity of decompressing/recompressing the output is probably not worth the added benefit.

It would be better to instead disable the compressed responses from your backend server; either directly (if your server supports that), or via a proxy that drops this header when the Accept header is text/html.

However, the best option would be to just support websocket directly instead of requiring the shim code injection.

For the case of the Inverting Proxy server, that could be implemented here, by converting the shim logic from Javascript to Go.

I'd be open to any pull requests that added that.

If you were to use the AppEngine version of the proxy that would not help you (since AppEngine does not support websocket), but from your screenshots it looks like you are not doing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants