Giter Club home page Giter Club logo

Comments (6)

roh26it avatar roh26it commented on June 2, 2024

Hi @rojosinalma,

Thanks for reaching out!

The gateway respects the Accept-Encoding header in the request. You can try setting it to identity in your requests to disable compression.

Let me know if you need more help

from gateway.

rojosinalma avatar rojosinalma commented on June 2, 2024

Thanks for explaining, but I still don't fully understand how is what you mentioned going to bypass what's hardcoded in the block I posted.

Could you give me more information please?

from gateway.

VisargD avatar VisargD commented on June 2, 2024

Hey @rojosinalma - The compress middleware code that you have pointed out is written in a way that it will only do compress if the Accept-Encoding has a compression technique mentioned in it or if the code itself imposes a compress technique. In the case of gateway, we have not mentioned any compression technique, so it will rely on Accept-Encoding header. So if you send Accept-Encoding as identity, then it will not apply any compression on response. I hope this helps.

from gateway.

rojosinalma avatar rojosinalma commented on June 2, 2024

from gateway.

VisargD avatar VisargD commented on June 2, 2024

The same link that you have shared contains this info: https://hono.dev/middleware/builtin/compress#options

The compression scheme to allow for response compression. Either gzip or deflate. If not defined, both are allowed and will be used based on the Accept-Encoding header. gzip is prioritized if this option is not provided and the client provides both in the Accept-Encoding header.

Here it is mentioned that Accept-Encoding header is used to determine the type of response compression. So if you do not send it, then hono will not compress it.

Regarding the identity value for accept-encoding, its a HTTP standard that is also mentioned in MDN web docs. So you can either remove accept-encoding from request header or send it as identity to inform server to not apply the compression. Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding#identity

When you send the header as identity, the code that is written inside hono compress middleware will not find any encoding and gateway also does not pass any default encoding method, so it will skip compressing the response. Here is the code for hono compress middleware: https://github.com/honojs/hono/blob/main/src/middleware/compress/index.ts

from gateway.

rojosinalma avatar rojosinalma commented on June 2, 2024

from gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.