The issue concerns a bug in Discourse’s subfolder setup, specifically with the /f subfolder, where the FAQ link and route fail due to incorrect URL matching logic. renato identifies that the get-url function incorrectly treats /faq as part of the subfolder path, leading to broken links and a 404 error on /f/faq. A proposed fix changes the URL matching logic to ensure proper subfolder handling. Additionally, the 404 issue is resolved by adjusting the Nginx location directive from location /subfolder to location /subfolder/. The nav bar displaying both ‘Guidelines’ and ‘FAQ’ is noted as expected behavior. renato submits a PR for the fix and confirms the issue is resolved, with the solution documented in a how-to topic. sam confirms the issue can be closed, and renato acknowledges the documentation update. sam encourages editing the wiki.
First, this is an edge case very specific to my setup, with the /f subfolder.
Discourse link on hamburger menu points to /faq, without the subfolder, because /faq startsWith /f.
Considering this quote:
I guess we could change
const found = url.startsWith(baseUri);
to something like
const found = url === baseUri || url.startsWith(`${baseUri}/`);
So it would match /f, /f/, /f/faq, but not /faq, correctly prepending the baseUri to the latter.
Anyway, the route itself also doesn’t work, /f/faq returns a 404, so I think there’s similar logic on the router level. I’ve previously noticed that /f/following wasn’t working as well (cc @merefield).
Finally, I changed the faq url site setting to /f/guidelines as a workaround, which fixed the link and the 404, but generated a minor oddity of having both the Guidelines and FAQ terms on the nav bar, both pointing to what’s set on faq url (you can check on the actual page):
About the 404 on /f/faq and /f/favicon/proxied, when I CURL these routes inside the container, bypassing Nginx, it works. I was able to fix it by changing the location directive described in Serve Discourse from a subfolder (path prefix) instead of a subdomain from location /subfolder to location /subfolder/.
The nav bar showing both Guidelines + FAQ is the expected behavior, it’s unlikely the user will override the faq url with the same url.