Multiple trailing or misplaced / can cause page to load as a blank page

AI-generated summary

The discussion addresses an issue where multiple trailing slashes in a URL (e.g., https://try.discourse.org//) cause Discourse forums to load as blank pages instead of displaying a proper error. nodalat reports this behavior across various Discourse sites, noting that browsers may auto-complete URLs with a single slash, but users might inadvertently add a second, leading to blank pages. JimPas observes that while some sites like AP return a 404, Discourse shows a blank page without an error, which may be due to how the Ember router or custom location handling processes double slashes. sam clarifies this is not a bug but a potential area for improvement, possibly in the Ember router. j.jaffeux identifies the issue and confirms a fix has been implemented via a commit b824af02. pinder99 adds that even a blank page may still load background assets, demonstrating the issue visually.

https://try.discourse.org/ works https://try.discourse.org// hangs with a blank page display on safari and chrome.

including meta.discourse.org and adding a / after the domain name e.g.

https://meta.discourse.org//top/weekly will hang.

1 Like

It’s the extra forward slash that is causing the pages to not load. Everything works as expected with the single slash. Why do you seem to insist to use an extra slash at the end of the URL?

If I use a double slash at the end of my forum’s URL, it does the same - blank page… as expected.

1 Like

I am aware of the cause. If the domain name of a forum is put in the address bar of a browser and it autocompletes to a single slash but the user types an extra one on the end, it’s going to give a blank page for any discourse forum - this is not desired behaviour, is repeatable and is consistent across URI’s.

A further issue would be that the browser’s autocomplete may then add a double slash since the blank page format does not throw an error so until the browser deletes it’s autocomplete history that would be blank forums for ever more.

1 Like

If you type in https://apnews.com//, you will be taken to the Associated Press’ website and receive a 404 - Page not found. No content gets loaded. The only difference I see is that AP throws a 404, and the Discourse sites only give a blank page (without a 404).

Auto-complete still only shows one forward slash at the end as I type.

So maybe the “bug” is not giving a 404 when a double-slash is used?

3 Likes

The ‘bug’ causes the forum software to still load many megabytes of information according to the safari and chrome console’s just not display it.

1 Like

When URL redirects and/or routing are expecting a single slash, having a double slash will “break” what was expected. On a static page, you may (probably will) get everything to load properly. But on a dynamic page, that’s where problems crop up. Even some CGI apps which may directly analyze the URL will fail. Some servers may even see multiple slashes as a form of exploit attack, especially if the double slashes are in the middle of the URL.

Maybe one of the Discourse team can give a better explanation as to how Discourse responds to multiple slashes. But it would be better if a 404 was given in such cases.

2 Likes

This is not a bug, I support improving the 404 page here or doing a redirect or something else.

Maybe there is a trivial change in our ember router, I don’t know, will defer to the ember experts.

4 Likes

Pretty sure ember has this fixed for a long time, it’s probably our custom location stuff or similar that is causing this.

Will have a look today.

6 Likes

That should fix it:

https://github.com/discourse/discourse/commit/b824af02d452e2d907690d1743b1b40eedb7667c

6 Likes

extra / will show you background of forum , teshghost.tk// (you can see my background wallpaper)

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.