-
Notifications
You must be signed in to change notification settings - Fork 87
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
Proxy sending CONNECT requests for http requests #183
Comments
CONNECT is only required for HTTPS, but it's perfectly valid for HTTP too (or actually any other protocol at all - it's just a generic tunnel) and it's generally preferable to use it for everything since there's no downside and it keeps the tunnelling approach consistent. There are also plenty of proxies who only support CONNECT (who don't accept direct requests for other URLs) so it's better for compatibility. Is there a specific reason you don't want this to happen? |
Thanks for the quick response, it would be useful to have an option to disable this CONNECT request for http request, as we know of at least one application where the CONNECT request is used to flag if the connection is secure or not |
That's interesting. What application? To be honest, I'm not sure it's a good idea - that just sounds like a bug in the application (it's making a security assumption that's not correct at all here) that needs fixing on their side. There's plenty of other software that expects all proxies to support CONNECT too. In my experience, it's the standard approach. Wikipedia also says:
and Cloudflare's very first example in their intro to HTTP proxying is actually plain HTTP via CONNECT: https://blog.cloudflare.com/a-primer-on-proxies/#http-1-1-and-connect. It's super common and standard. We could migrate away from that, but it's likely to cause far more problems in the other direction I expect. |
Thanks for all the great information and explanation, I really do appreciate it. It's an internal application and we’d have to discuss with the maintainers of it on why it works this way, but based on what you’ve said it looks like something that should most likely be changed in that applications implementation. So we’ll follow that up with them next week, but thanks again for the help! 👍 |
Hey, while using mockttp, we noticed mockttp sending CONNECT requests for
http://
requests. My understanding is CONNECT request should only be used forhttps://
requests? Here's a script that shows the behaviour clearly:Both these curl request trigger a CONNECT request:
curl -k --proxy http://127.0.0.1:3010 http://demo.testfire.net/
curl -k --proxy http://127.0.0.1:3010 https://demo.testfire.net/
When we don't proxy via mockttp, we only see a CONNECT request for
https://demo.testfire.net
which is what I'd expect:curl -k --proxy http://127.0.0.1:3011 http://demo.testfire.net/
curl -k --proxy http://127.0.0.1:3011 https://demo.testfire.net/
My question would be is there a reason mockttp behaves like this because it seems unexpected that mockttp would send CONNECT requests for http requests?
The text was updated successfully, but these errors were encountered: