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

Support for ["accept-encoding"] = "identity" #9

Closed
simonw opened this issue Nov 6, 2024 · 2 comments
Closed

Support for ["accept-encoding"] = "identity" #9

simonw opened this issue Nov 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 6, 2024

I ran into a problem with this proxying OpenAI because they use brotli encoding, and the proxy was serving through the encoded binary data - which means that any future features to mess with the content wouldn't work, refs #5

I found that this fixed the problem:

diff --git a/asgi_proxy/__init__.py b/asgi_proxy/__init__.py
index 98ab369..3e7dc43 100644
--- a/asgi_proxy/__init__.py
+++ b/asgi_proxy/__init__.py
@@ -17,6 +17,8 @@ def asgi_proxy(backend, log=None):
         # Replace host header
         headers["host"] = backend_host.encode()
 
+        headers["accept-encoding"] = "identity"
@simonw simonw added the enhancement New feature or request label Nov 6, 2024
@simonw
Copy link
Owner Author

simonw commented Nov 6, 2024

Maybe this should be another option to the def asgi_proxy(backend, log=None) function.

@simonw
Copy link
Owner Author

simonw commented Nov 6, 2024

I'm just going to default to this for the moment - it's the only way I can get OpenAI proxying to work.

@simonw simonw closed this as completed in 1c16fc9 Nov 6, 2024
simonw added a commit that referenced this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant