Quickly rejecting HTTPS (port 443) requests?

vvvjv0
Posts: 1
Joined: Tue Jan 27, 2026 2:34 pm

Quickly rejecting HTTPS (port 443) requests?

Postby vvvjv0 » Tue Jan 27, 2026 2:37 pm

Many versions of Safari (on MacOS) have a bug in which if given an http:// url they first try the corresponding https:// url. This causes a 5 second delay in accessing http:// links on an ESP32.

Is there a way to get the ESP32 to quickly reject any HTTPS requests (port 443) so that Safari does not wait 5 seconds for a response.?

I've found resources for setting up an actual https server on an ESP32, but I don't want to incur the overhead of an actual server. I just want to quickly and efficiently inform misguided we browsers that there is no point in sending requests on port 443.

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: Quickly rejecting HTTPS (port 443) requests?

Postby lbernstone » Wed Jan 28, 2026 3:15 pm

You can base your response on the WiFiServer example. If you get a connection on port 443, just immediately send a error response. At line 70, instead of reading anything in, print a 501 response (a la line 80), and then send a stop. It may even be more effective to just send the stop.

Who is online

Users browsing this forum: No registered users and 1 guest