-
Notifications
You must be signed in to change notification settings - Fork 21
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
Example to modify response from server #2
Comments
Currently http-proxy does not compile or work correctly with the current versions of the Conduit library. Once that is fixed it should be possible to do this. |
Hey! Any news on this one? Thanks. |
Sorry, been busy, but actually working on it this weekend. |
Just curious, what is it you want to modify, the response headers? The body? Both? |
BTW, the version here in GIt actually works (see https://travis-ci.org/erikd/http-proxy ) if you want to play with it. |
Hi, thanks a lot for this library. I can't find the code that lets modify the response. Has the feature been implemented ? aculnaig |
Currently it is not possible to modify the response. It would be relatively easy to do this for HTTP, but not at all easy for HTTPS because for HTTPS connections the proxy simply acts as a transparent two way transport of encrypted bytes between the client and the server. The proxy could theoretically decode this encrypted stream, but not be able to modify them and then re-encrypt them (because the proxy does not have access to the private encryption key the server uses to perform encryption). In order to decode and/or modify either the request or the response, would require the implementation of what is called a MITM (man-in-the-middle) feature. In this mode, the proxy generates its own SSL certificate and uses this SSL certificate to the client (which must manually accept it). The proxy then gets the request from the client, passes it upstream, retrieves the response and decodes it (where it could be modified), then re-encrypts it using its own SSL key. I am interested in doing this, i just have no idea when I may get it completed. |
I have some time this week that I would like to spend on a MITM feature. Libraries that I've used in other languages handle this by either 1) generating a CA cert or 2) accepting one as configuration, and minting + caching a short-lived certificate for each host name they proxy a request to. @erikd do you have an idea of how you'd like to see this implemented? |
I have a working proof of concept for this now, but it is very rough (I had to hack my way around my lack of conduit knowledge). I may clean it up soon and can open a PR if there is interest, otherwise feel free to ping me for code. |
I too have started thinking about this, but I am currently traveling for work. Let me get back to you on this. I would also be happy to look at any code you have. |
I have been messing with this a bit and I think the best way to do it is to add a separate module for the MITM functionality. Obviously, whatever can be shared should be. |
@juturnas I would be really interested in seeing what you have. There are a number of ways of doing this and two that I have tried so far are problematic in one way or another. |
Any updates on this? Unless I'm misunderstanding, you can't easily implement a caching system currently, not interested in MITM SSL connection. |
Hello,
This is more a question rather than an issue/feature. Is there anyway to modify the response from the server in the proxy? I want to add extra script tags to the body.
I'm reading the code, but I can't find any clear entry hooks to do this. Any guidance is highly appreciated.
Cheers.
The text was updated successfully, but these errors were encountered: