Domain missing from some requests after migration from subfolder back to subdomain

AI-generated summary

After migrating a Discourse installation from a subdirectory to a subdomain, the theme-javascripts domain was being called instead of the subdirectory. Magnetidog reported the issue and tried rebuilding the application without success. pfaffman suggested checking the URL and app.yml file, and Magnetidog found that the issue was caused by a double slash (//) in the URL. merefield asked about the hostname value, and Magnetidog suspected a database issue. The problem was ultimately solved by Magnetidog using the discourse remap command to update the URLs in the database:

./launcher enter app
discourse remap //theme-javascripts  /theme-javascripts

This solution may help others experiencing similar issues after migration.

Hello guys,

I have a Discourse installation which was living in a subdirectory and has now been moved to a subdomain. Everything seems to be working now, but we have a pending problem where Discourse calls the “theme-javascripts” domain instead of a subdirectory.

Latest Discourse version.

How can we solve this?

Thanks.

Did you follow Serve Discourse from a subfolder (path prefix) instead of a subdomain backward?

Can you share your URL?

Jay, I did - not my first rodeo doing this, either, in the past without issues. The new URL is (hiding URL).

Do note: a designer is currently working on the style, so you might see weird things happening in the navigation, right now.

I see, something is referencing

https://theme-javascripts/44e23af3ca6cf81f41e66da02a80e1c9b45653cc.js?__ws=community.windowcleaner.com

instead of

https://community.windowcleaner.com/theme-javascripts/44e23af3ca6cf81f41e66da02a80e1c9b45653cc.js?__ws=community.windowcleaner.com

Maybe there is something left in your app.yml that’s referring to. . . hmm. . . something (like maybe a “/”) that’s making it add the https to the front?

Indeed, that is what is happening - trying several rebuilds, no luck yet. If I manage to find out I will update the thread!

Still no luck with this one! I narrowed it down to code that comes from the official plugins - I will update this if I find a solution.

Is your hostname blank somewhere?

What’s the value of DISCOURSE_HOSTNAME: in app.yml?

Hey @merefield, not blank - the value is (hiding URL). But I suspect the same, or something along those lines, as the theme-javascript is being called with two slashes in front of it. I wonder if it could be some value in the database which was not updated after the move from the subdirectory. Trying to look into that.

I think I fixed it - all I had to do was a remap; not sure how that wrong URL was there in the first place, as the error appeared after a rebuild that was not done by me.

Anyhow, this is what I did to fix this:

> ./launcher enter app
> discourse remap //theme-javascripts  /theme-javascripts
> Rewriting all occurrences of //theme-javascripts to /theme-javascripts
> THIS TASK WILL REWRITE DATA, ARE YOU SURE (type YES)
> YES
> theme_fields=4
> Done

Hope this helps somebody else in the future.