# Image upload, relative path instead of full path

**URL:** https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533
**Category:** Support
**Created:** [February 1, 2018, 9:41am UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533 "2018-02-01T09:41:34Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)
#### Post date: [February 1, 2018, 9:41am UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/1 "2018-02-01T09:41:34Z")

</div>

Hello,

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

![image](https://global.discourse-cdn.com/meta/optimized/3X/7/9/79ef88e24d529ef8334e1d14e1f1efd98c2174b2_2_690x53.png)

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

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [February 1, 2018, 10:24am UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/2 "2018-02-01T10:24:10Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)
#### Post date: [February 1, 2018, 10:26am UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/3 "2018-02-01T10:26:09Z")

</div>

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

ext ([external.com](http://external.com)) → int ([example.com](http://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 ?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [February 1, 2018, 10:29am UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/4 "2018-02-01T10:29:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 1, 2018, 1:26pm UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/5 "2018-02-01T13:26:25Z")

</div>

> [@Chopper](#):
>
> In fact, why this is not relative path by default ?

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

---

<div class="post-metadata">

### Author: ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)
#### Post date: [February 1, 2018, 3:03pm UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/6 "2018-02-01T15:03:23Z")

</div>

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

```plaintext
DISCOURSE_CDN_URL: //externe.com:8883

```

And rebake all the post !

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/image-upload-relative-path-instead-of-full-path/79533/7 "2024-06-08T12:43:27Z")

</div>

This topic was automatically closed after 2319 days. New replies are no longer allowed.
