404 for svg-sprite on localhost:8000

Hello. I am running a new discourse instance with the relevant config:

hostname =  localhost:8000
relative_url_root = /forum

Some of the resources are not loading. For example the following gives a 404 error:

http://localhost:8000/forum/svg-sprite/localhost:8000/svg-2-ea6ff3f2981a98a7323fb5294880aa4255c98f87.js

If, however, I manually change the url to `/svg-sprite/localhost/…’ it loads.

Why aren’t you using port 80?

Publishing on nonstandard ports isn’t supported.

Because I am just testing it locally and have other stuff on port 80. I did eventually find a fix, by adding this to nginx.conf:

rewrite /forum/(svg-sprite|user_avatar)/([^/]+):[0-9]+/(.*) /forum/$1/$2/$3;
2 Likes