HTTPSecureSocket with security set to false accessing http url 400 Bad Request error

My site is https with the exception of a few URLs that are redirected to the old http version, I modified the site .htaccess to allow that, it works fine with Safari, Chrome, Firefox…etc… the expected data is simply returned, no padlock is displayed, I am really getting a http response. Other URLs are properly redirected to https

However with a Xojo HTTPSecureSocket with security set to False all I get is this error:

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

With a HTTPSocket it works perfect!!!

The doc says that HTTPSecureSocket with security set to False is like a HTTPSocket. Not tin this case or maybe there is a bug here???

I think you probably have to try with HTTPSecureSocket with security set to true.
The initial talk to the server will still be https, and only after the redirect it will be http.
Have you tried that?

PS: Bard request error. Now that’s funny :wink:

Yes indeed :-/ :slight_smile:

Using the HTTPSecureSocket is probably trying to connect on port 443, but using HTTP, so try setting the port to 80 as well as the secure to FALSE… I see this with my own server and the Safari web browser… <-- causes the same error that you see above, probably happens with a lot of servers as well…