traccar / traccar-manager-android

Traccar Manager for Android
https://www.traccar.org/manager
Apache License 2.0
266 stars 379 forks source link

Follow HTTP redirections to HTTPS server #77

Closed kobisamoray closed 4 years ago

kobisamoray commented 4 years ago

When Traccar is relocated to HTTPS listener, URL should be followed within the code to reach new location.

tananaev commented 4 years ago

The right solution is to call setFollowRedirects.

kobisamoray commented 4 years ago

setFollowRedirects will not redirect HTTP to HTTPS, but only within the same protocol. https://stackoverflow.com/questions/1884230/httpurlconnection-doesnt-follow-redirect-from-http-to-https

Could be nice addition as it'll save the manual redirect for same protocol redirects.

tananaev commented 4 years ago

I guess we should do something like this then:

https://www.cs.mun.ca/java-api-1.5/guide/deployment/deployment-guide/upgrade-guide/article-17.html

kobisamoray commented 4 years ago

To handle recursed redirection? Is that a common things (just a question, never ran into such). I don't mind changing, just want to avoid cumbersome code which doesn't have a practical use.

tananaev commented 4 years ago

Well, need to check for protocols, need to check for other redirect codes. Not sure about multiple redirect. That is probably not required.

kobisamoray commented 4 years ago

Fair enough. setInstanceFollowRedirect() will handle anything other than protocol change and it defaults to true so no point in enabling it. I'll check for HTTP_MOVED_PERM as well.

kobisamoray commented 4 years ago

Closing this as functionality is implemented in master.