You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
Hello, I'm trying to proxy requests to Github but I'm always getting this error on the serverside:
http: error: ContentDecodingError: ('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing: incorrect header check',))
Do you have any ideas how to solve it?
The text was updated successfully, but these errors were encountered:
I had this problem too! I just figured out the solution in my case.
In my case I had another middleware after the koa-better-http-proxy. The problem arises when your proxy middleware finishes. It's set the response to all of the right things, but then it calls next and whatever you have after it in the chain can clobber it.
My solution was to wrap it in my own middleware and pass () => Promise.resolve(null) to it as a second argument.
functionmyProxyWrapper(ctx){awaitkoaBetterHttpProxy(config)(shop,{
...myConfig,/* We want this middleware to terminate, not fall through to the next in the chain, but sadly it doesn't support not passing a `next` function. To get around this we just pass our own dummy `next` that resolves immediately. */})(ctx,()=>Promise.resolve());}
Another alternative might be to use the koa-mount middleware to stick it on it's own endpoint that won't interfere with anything (I think?)
Just had this same issue; koa-mount only solves this particular issue if you don't have a catch-all middleware. In my case, I have a server-side-rendered react app and share react-router with the server and client, so I ended up having to wrap it all in a middleware anyways:
Hello, I'm trying to proxy requests to Github but I'm always getting this error on the serverside:
Do you have any ideas how to solve it?
The text was updated successfully, but these errors were encountered: