Code Monkey home page Code Monkey logo

Comments (4)

sec23206 avatar sec23206 commented on August 12, 2024

Actually, I just tried something which had an effect ... in the startup for Kong, we include this setting:

-e "KONG_HEADERS=X-Kong-Proxy-Latency, X-Kong-Response-Latency, X-Kong-Upstream-Latency, X-Kong-Upstream-Status, X-Kong-Admin-Latency" \

This is because for security reasons, we want to ensure Kong does not include the "Via" header to clients (so they don't know they are talking to Kong). My understanding about this setting is that it tells Kong which are the "legal" headers to send to a client. When I removed this from the startup, now I'm seeing the X-Kong-Upstream-Status header that my plugin is adding. But I don't understand why the other "legal" headers like X-Kong-Upstream-Latency went through OK, and what is the connection between this setting and a bespoke plugin that tried to set one of the headers.

from kong-js-pdk.

fffonion avatar fffonion commented on August 12, 2024

@sec23206 In which phase is your plugins setting the header?

from kong-js-pdk.

sec23206 avatar sec23206 commented on August 12, 2024

@sec23206 In which phase is your plugins setting the header?

In the response phase.

from kong-js-pdk.

fffonion avatar fffonion commented on August 12, 2024

I feel like reponse phase is the reason but haven't verified. Although as it's name suggested, response phase
is not actually what Kong is producing responses. It's more for plugins that requires to do some mutation or inspecting
of the response body. But access may just be too early for your use case. In Lua Kong you can use header_filer but they
are not part of JS PDK.

Could you print the result of await kong.service.response.getStatus() in the same phase?

from kong-js-pdk.

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.