Re:API Shouldn't Redirect HTTP to HTTPS
by Hizonner on Tuesday May 28, 2024 @09:18PM
(#40507264)
Why not just stop listening on port 80, period?
[ Parent
| on HN ]
It’s a good option, but you can’t give users a reason for the failure. They might even assume your service is broken.
Re:API Shouldn't Redirect HTTP to HTTPS
by inopinatus on Wednesday May 29, 2024 @12:03AM
(#40508330)
I think it's fair to assume j. random user isn't typing "http://api.example.net" into their web browser.
leading www perhaps, leading api no.
You'd be surprised... generally if there's a dedicated hostname for the API, I would expect / to either display or redirect to API docs.
Also, doesn't help when you're reverse proxying /api to $API/api
Re:API Shouldn't Redirect HTTP to HTTPS
by inopinatus on Thursday May 30, 2024 @01:05AM
(#40520257)
Posting on this forum means you are probably not J. Random User. I mean specifically anyone who will not grasp the difference between http:// and https://api.example.com.
I stopped listening on port 80 for everything… nobody’s complained yet! Maybe because they can’t find the service though.
Because the whole point is a mitm can compromise it, and the mitm can listen on 80 regardless if you turn yours off.
Re:API Shouldn't Redirect HTTP to HTTPS
by freedomben on Wednesday May 29, 2024 @11:22AM
(#40512931)
I've done that myself and have consumed many others who have done it, and I don't think it's better. Much better to get a response that tells you to use https for the API. (for browser also a redirect is a must for UX, though our context here is API)