Issue with redirect from https to http

OK, I don’t mean to brag, but I programmed in over 30 languages by my 20s and web applications since the 90s. I prefer TS today in both the back-end (node) and front-end (Angular). I don’t program in PHP because I really like being able to share code in both the browser and back-end that TS permits today, via Node libraries.

That said, I’m telling you that when you log out, it will in two places REDIRECT from the HTTPS to HTTP. I include port “:444” after the host, of course. In that case, it does not change the “:444” in the host, thus you get the error I pasted in the OP.

I told you, If you configure to only work on 443/80, and it is on BOTH, then it works, because it will seamlessly use port 80 then go back to 443 when there is no port designation in the URL due to how the browser defaults to those ports when there is no override with the port suffix after the host name. This configuration, however, is NOT an option for several reasons.

  • I do not want HTTP to be accessible on the public network. Only HTTPS.

  • I need to route several HTTPS ports for different ownCloud instances through routers that do not support name based virtual hosting. Most port forwarding in OTS routers only handles ports, and not host name filtering. Thus, there is no way to route multiple name based port forwarding through the same port, ie port 443.

Thus, I need the specific non-443 use case to work, and shared with you the outcome of using port 444.

Somewhere in your code when a user clicks to login, or if logged in, when they click to logout, you appear to have something forcing use of “HTTP”, despite the browser URL set to use HTTPS.

Like I said, these are the only points it does this. Please replicate this issue by setting up HTTPS on a non-standard port such as 444, OR make sure that ownCloud is NOT on port 80.

You can leave other things running on port 80. If you are using port 443 for HTTPS, you’ll just get a different error about the page not being found if it is not available on port 80. One of these pages is “/login” IIRC. When redirected, it insists on first accessing this page via HTTP before then redirecting to back to HTTPS.

The solution is to find out where in the code at these times, login and logout, it REDIRECTS to using HTTP.

Note also that the reason you won’t “see” this if using 443/80 is because once it redirects to HTTP, it immediately redirects back to HTTPS if the HTTP successfully accesses w/e it is trying to access in ownCloud. So, it’s a fast blip you may not notice. You will only reproduce this issue if it cannot satisfy the HTTP request.