Main domain used as hostname instead of DISCOURSE_HOSTNAME for emoji path

Hi,

I have an installation up and running but have a problem with emoji image path.

I have used this guide: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md and have used

./launcher rebuild app

after changing settings in app.yml

I may have initially configured

DISCOURSE_HOSTNAME: 'bar.com'

But layer changed to

DISCOURSE_HOSTNAME: 'foo.bar.com'

Say I have a main domain:

bar.com

and a subdomain:

foo.bar.com

which for some URI’s uses Apache’s ProxyPass, e.g. for foo.bar.com:

...
ProxyPass "/" "http://localhost:8090/"
ProxyPassReverse "/" "http://localhost:8090/"
...

and in app.yml I have the following settings:

DISCOURSE_HOSTNAME: 'foo.bar.com'
DOCKER_USE_HOSTNAME: true

then everything is loaded as expected (including other images) except emoijis, e.g.:

:confetti_ball:

in which case it attempts to retrieve the image from the main domain:

GET https://bar.com/images/emoji/google_classic/confetti_ball.png

with a 404 response.

It appears that the bar.com is used instead of foo.bar.com as an absolute path in this particular situation, i.e. from the source code of the loaded page it refers respectively to a relative path

<meta name="twitter:image" content="/images/default-apple-touch-icon.png" />

and an absolute path

<p>Congratulations! <img src="//bar.com/images/emoji/google_classic/confetti_ball.png?v=5" title=":confetti_ball:" class="emoji" alt=":confetti_ball:"></p>

In the case of a relative path it works, but for the absolute path it doesn’t. And I don’t know how to change the absolute path :confused:

BR

You will need to do a remap

# ssh into your server
cd /var/discourse
./launcher enter app
discourse remap "bar.com" "foo.bar.com"
5 Likes