Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For full encryption, does my initial request need to be HTTPS or is it enough for the server to redirect HTTP to HTTPS?

We develop a desktop application and it makes requests to our own API endpoints. Right now all the requests that the desktop application makes to our API are HTTP. I now want all those requests from within the application to be encrypted. Is it enough to simply do an .htaccess HTTP to HTTPS redirect to achieve that? Or do I need to go into the app and make sure that each request starts out as HTTPS?

like image 297
Ryan Avatar asked Mar 06 '26 20:03

Ryan


1 Answers

You really need to make sure that each API request is done via HTTPS in the first place.

A re-direct (if it even works with POST requests at all) would just result in the request being sent twice (and the first one would be unencrypted, so that an eavesdropper could read everything).

Also, if you app does not require HTTPS (potentially with a pinned server certificate) it is subject to man-in-the-middle attacks: The man in the middle can just intercept the request, never connect you to HTTPS, change the response data at will and your app would not mind.

like image 81
Thilo Avatar answered Mar 09 '26 17:03

Thilo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!