I’m sorry if I’ve misdiagnosed this, but I’ve recently experienced some issues after an upgrade on a subfolder setup that had been working before, so I think there may have been a regression on some fronts in the recent past? In particular, I am self-hosting Discourse using the subfolder setup described here, which was happily working (AFAICT) until recently.
Currently, when logging in using SSO or when switching to/from anonymous mode (and maybe in other situations I’ve not yet found), I am redirected to https://my_machine/discourse_path_stuff , rather than being redirected to https://my_machine/forum/discourse_path_stuff. It’s also the case that when I go to https://my_machine/forum (the right endpoint), my address bar is rewritten to say https://my_machine (with the subfolder removed), though most links seem to resolve to the right places.
Unfortunately, I don’t remember what commit I was running on when things were working, but I’m pretty sure it was under the “2.4.0.beta10” umbrella, and was probably within the last ~10 days. I am currently running on bd49d4af1a.
I apologize if I’m just doing something stupid, and I’m happy to help with tracking down the issue if there are suggestions for where I should be looking.
We’re using the Discourse SSO protocol, which was definitely working smoothly before. The handshake still seems to happen fine, just redirecting to the wrong place at the end. The "return_sso_url" key in the SSO payload is coming back to our SSO endpoint correctly, though (with /forum).
I also tried a rebuild, but that didn’t seem to fix the issue.
Unfortunately, this may be difficult to debug since I’m not really comfortable giving outside people access, since this instance exists for a class, and I don’t feel comfortable sharing student data with outside parties (even if I trust you personally!). But if it helps, I’m happy to try to replicate this setup on a different server that I could give you access to…
I also see that the link for entering/leaving anonymous mode is using the window.location.reload() to reload the page after sending a request to an endpoint to switch to anonymous mode. So that reload would definitely see the rewritten URL (no longer containing /forum), which would cause this (not sure if it’s a similar story for the SSO problems).
I’ll take a peek at the recent changesets to see if the thing that (I think?) is rewriting window.location is a recent addition.
Also, Discourse.getURL('/login') still gives me the right result (with /forum).
The paths reset without subfolder prefix in the address bar of the browser.
Example:
I visit example.com/forum -> after forum loaded, address bar shows example.com
Then I click on “Latest” -> navigates to latest and address bar shows example.com/forum/latest
I hit refresh on browser, website refreshes and address bar shows example.com/latest
When I refresh again while on example.com/latest, there is a 404 error (because my nginx only routes /forum to discourse).
The link preview at bottom left of the browser show up as example.com/latest, example.com/new etc. Refreshing a topic also removes /forum from the url, but then it changes again, back to /forum/t/[…].
I was at version 2.4.0.beta2 previously and don’t remember this issue.
From poking around in the recent(ish) commits, though, I couldn’t see an obvious point where this rewrite was happening. Would it be possible to get a pointer to where in the code this was/is happening? (I’m in the process of trying to familiarize myself with the codebase).
It would be! I’m just not your guy. I’m just “that guy” on the team that happens to have a local subfolder install. But I’m not an engineer. David should be able to point you in the right direction when he starts working on the issue later this week.