Image upload, relative path instead of full path


(Martial) #1

Hello,

When I upload an image on my Discourse, the image path is full not relative:

My question is, Is there any possibility to have the relative path /uploads/... instead of the full path ?


(Felix Freiberger) #2

Unless you want to write a plugin for that, I’m pretty sure there’s no way to do that.

Why do you want these links to be relative?


(Martial) #3

We use a SSH tunel to connect to our discourse from outside.

ext (external.com) -> int (example.com) but of course, all image are broken. With the relative path, there will be no problem.
In fact, why this is not relative path by default ?


(Felix Freiberger) #4

That’s not a supported setup – Discourse needs to know the hostname it is running at. I’m pretty sure that there will be more breakage than just images if the hostname is wrong.

I you need outside access to Discourse, you’ll need to use a technique that allows you to access Discourse at the original domain name configured in app.yml, e.g. a VPN tunnel.


(Régis Hanol) #5

If you put the images on a CDN then your problem is gone :wink:


(Martial) #6

Damm simple. I juste add this in the config file:

DISCOURSE_CDN_URL: //externe.com:8883

And rebake all the post !