SwiftNIO wrong method come to proxy server

I am using SwiftNIO with the Connect Proxy based on the official example (swift-nio-examples/connect-proxy at main · apple/swift-nio-examples · GitHub ).

I read that browser or application knows that in the beggining it connect to proxy, and sends HTTP CONNECT request. But when I try to CONNECT to rediff.com from iOS Safary, in my local proxy (which works in NetworkExtension) I get GET method instead of CONNECT and close this connection with Error as was in SwiftNIO with the Connect Proxy example.

Why wrong method come to proxy for this website, how to handle this problem?

@lukasa Can you look at my question?

What is the full URL, including scheme, that you're typing into Safari?

Browsers only use CONNECT for https requests. For http requests they send the request as usual, with a different uri in the request head.

When I type in safary: rediff.com -> create connection to http://rediff.com and page does not load (write not secure),
when I enter https://m.rediff.com this page opens correctly.

Is it site problem, that it is create default http connection ?

Nope, this is a standard behaviour: by default, most URLs will create a HTTP connection, not a HTTPS one. This is a long-standing issue for web browsers. There are some ways to change this default (mostly by using HSTS Preload) but that is not mandatory for websites.

1 Like
Terms of Service

Privacy Policy

Cookie Policy