-
Notifications
You must be signed in to change notification settings - Fork 660
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
Response GZipped even when no 'accept-encoding' is defined? #74
Comments
You control how/when to gzip in your app. This library will base64 encoded responses when the content-type matches one you specify in the binaryMimeTypes list (third param of createServer). In order for this to be encoded correctly in the final response to the client, you must also specify your binary mime types on API Gateway. Replied to your comment in #39 also which I assume is the same issue. |
The response flow looks like: Express response -> compression/gzip middleware (if you use it) -> aws-serverless-express (encodes to base64 if content-type is specified in binaryMimeTypes in Lambda handler) -> API Gateway (decodes base64 if content-type matches a binary mime type specified on API) -> Client If client receives base64, it indicates your API binary support needs to be configured and redeployed. |
Thanks @brettstack, I've already configured API Gateway through Swagger with SAM, similar to how it is done in the example. That is, my Swagger template contains:
at its root, and my code contains
I've also made sure that changes to the API have been applied through the SAM stack. My list of binary types for this API in the Console indeed contains |
Ok sorry for trouble, it seems that API Gateway doesn't understand |
I guess the after-thought question is, why does API Gateway ignore |
Try sending Accept header with application/json
…On Thu, May 11, 2017, 7:37 PM Denis Loginov ***@***.***> wrote:
I guess the after-thought question is, why does API Gateway ignore
application/json and only accept */*?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABy6l3S11x47Od7eJJXY3k9732eX0mKvks5r48YDgaJpZM4NYuWW>
.
|
I swear I've tried that before, but now it works too, thanks! |
Correct, mapping templates to not apply to Lambda Proxy |
I still think there's an issue regarding |
Hi Team,
It seems that when I don't set
accept-encoding
header, or set it to''
, it always returns a Gzipped (and base64-encoded) response. Is that intended behavior? It seems that if the client doesn't explicitly request encoding, we shouldn't compress the response (even if it exceeds the size threshold).Thanks
P.S. Sorry but I'm a bit new to encoding - perhaps this has been explained already, but reading through other issues I didn't get a clear picture of how it works.
The text was updated successfully, but these errors were encountered: