Closed kobisamoray closed 4 years ago
The right solution is to call setFollowRedirects
.
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.
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
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.
Well, need to check for protocols, need to check for other redirect codes. Not sure about multiple redirect. That is probably not required.
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.
Closing this as functionality is implemented in master.
When Traccar is relocated to HTTPS listener, URL should be followed within the code to reach new location.