Code Monkey home page Code Monkey logo

Comments (9)

darkweak avatar darkweak commented on September 21, 2024

Hello @acaporrini the Tyk plugin differs from the base middleware (because Tyk plugin doesn't as a basic middleware). I will have to update the plugin with the latest changes from the common middleware. I will have to write more Tyk e2e tests to ensure it has the same behaviour too.

Thank you for trying to use Souin inside Tyk and thank you for your feedback! 🙏

from souin.

acaporrini avatar acaporrini commented on September 21, 2024

Hi @darkweak thank you a lot for quick reply and for looking into this. Do you maybe have an idea on when this will be implemented?

from souin.

darkweak avatar darkweak commented on September 21, 2024

Hey @acaporrini I'll wrap the Tyk changes in the PR #335 it may take few days to be merged but I cross my fingers to merge and release before Friday. I don't have much time to work on the missing fix to make the pipeline green.

from souin.

darkweak avatar darkweak commented on September 21, 2024

Hello @acaporrini I apologize about my late answer. I don't find a way to handle that (because Tyk doesn't act as a classic middleware). The actual plugin behavior is like:

Tyk gateway request handled
        ↓
Load plugins
        ↓
SouinRequestHandler (it will keep in memory the stale response)
        ↓
Tries to connect to the upstream server
        ↓
SouinResponseHandler will write the stale response body, headers,...
        ↓
Writes the upstream response

Actually it writes the body twice (from the upstream and from the stale response)
I cannot short-circuit and I didn't find a way to prevent the body from being filled by the upstream server at the moment.
I don't know how to allow the gw to contact the upstream, serve the response from the cache but doesn't wait and doesn't write the upstream response.
Ping @buger @andyo-tyk @lonelycode @matiasinsaurralde if there is a way to do that.

from souin.

buger avatar buger commented on September 21, 2024

@darkweak wanna jump on quick debugging session? Ping me on [email protected], and we will figure out smth.

from souin.

darkweak avatar darkweak commented on September 21, 2024

@buger Did you received my email to plan a debugging session?

from souin.

buger avatar buger commented on September 21, 2024

Weird but no. I just sent you mail to [email protected], to test if all works.

from souin.

darkweak avatar darkweak commented on September 21, 2024

Received, I just sent you another mail in response to your.

from souin.

darkweak avatar darkweak commented on September 21, 2024

Not possible with the actual middleware implementation in Tyk. Some possible ways we discussed with Leonid are not viable so this feature can not be supported while they're not allowing the asynchronous upstream request in a middleware and return a value before the response from the upstream.

from souin.

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.