Subfolder trailing slash issue

AI-generated summary

The user joen reported an issue with a Discourse setup in a subfolder (e.g., www.example.com/forums) where omitting the trailing slash in the URL results in the forum only loading the header. Adding the trailing slash resolves the issue. joen investigated and found differences in the HTML output, particularly in the <body> and <section id="main"> elements.

david offered to help debug the issue, but joen mentioned the site is still in development and not publicly available.

david identified the issue and provided a fix via a GitHub commit, which should be available in the next hour. joen confirmed the fix works after updating, thanking david for the quick resolution.

We have a discourse setup in a subfolder (www.example.com/forums ) which used to work by leaving out the trailing slash.
Since the bug and fix (Recent Changes Breaking Subfolder Setup?) that we also encountered, we are now dealing with a new issue. When the trailing slash in the url is left out, our discourse forum only will load the header.
When adding the trailing slash and loading the url again, the site loads completely. I’ve been looking at the html output in firefox and noticed that when the trailing slash is not there, the following happens:
<body class "staff">...</body>
The following div also has 260px height:
<section id="main" class="ember-application">

Whereas with the trailing slash, it’s this:
<body class "staff navigation-categories categories-list>...</body>
And the section id div is 909px (which is expected as the categories have loaded).

This is all I was able to figure out so far. As mentioned, the trailing slash didn’t needed to be entered prior to the update that fixed the subfolder issue. Does anybody have an idea as to why this is happening?

1 Like

Are you able to share the URL of the site (here or via PM)? It would be useful for debugging

3 Likes

The site is still in development, and therefore not publicly available. I can check with our sysadmins if there is a way to access it from outside.

1 Like

I have identified the issue and it should be fixed by FIX: Restore initState() call within discourse-location for subfolder · discourse/discourse@19dcc6b · GitHub, which will hit tests-passed in the next hour. Please let me know if it works for you @joen

7 Likes

Thanks, I’ll update and report back today.

edit: @david It’s working, thank you for helping out so quickly.

6 Likes