# Images links are not correct , using nginx reverse proxy

**URL:** https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913
**Category:** Community Support
**Created:** [August 13, 2021, 8:09am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913 "2021-08-13T08:09:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forums.rocket.chat/u/bape)
#### Post date: [August 13, 2021, 8:09am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/1 "2021-08-13T08:09:03Z")

</div>

### Description

Hi,

The link to the uploaded images only works in de app but not in the browser.  
I have a nginx reverse proxy. Which location I have to add to make it work again in the nginx config?  
Version 3.16.4

### Server Setup Information

- Version of Rocket.Chat Server: 3.16.4

- Operating System: Ubuntu

- Deployment Method: 

- Proxy: \<!-- nginx/=

---

<div class="post-metadata">

### Author: ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)
#### Post date: [August 13, 2021, 9:32am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/2 "2021-08-13T09:32:07Z")

</div>

Hi.

You are going to have to provide us with a lot more information.

Nginx conf, logs, screenshots etc.

Read this for some ideas:

> <https://gist.github.com/reetp/a66149d5f060f260643a353ca7067a98>

---

<div class="post-metadata">

### Author: ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forums.rocket.chat/u/bape)
#### Post date: [August 13, 2021, 10:09am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/3 "2021-08-13T10:09:46Z")

</div>

nginx config:

```auto
upstream rocket_backend {
  server 127.0.0.1:3000;
}

server {
    listen 443 ssl;
    server_name xxxxxx;
    access_log /var/log/nginx/rocketchat-access.log;
    error_log /var/log/nginx/rocketchat-error.log;
    ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
    ssl_certificate_key /etc/ssl/private/xxxxxxx.key;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://rocket_backend/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto http;
        proxy_set_header X-Nginx-Proxy true;

        proxy_redirect off;
   }
}

```

![Screenshot 2021-08-13 at 12.09.23](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/0/0a6aeede63de6030cb2c595f75bbd9911615c338.png)

---

<div class="post-metadata">

### Author: ![debdut.chakraborty](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/debdut.chakraborty/32/2900_2.png) [@debdut.chakraborty](https://forums.rocket.chat/u/debdut.chakraborty)
#### Post date: [August 13, 2021, 10:42am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/4 "2021-08-13T10:42:38Z")

</div>

The most common reason behind the class of your issue is incorrect `Site_Url` setting. Can you please check if you have it correctly set up or not?

Check - `Administration` \> `General` \> `Site URL` - make sure the value is the exact string you use in your address bar to naviagate to your rc instance. The template is - `[protocol]://[domain_or_ip][:optional port][/optional subpath]`

---

<div class="post-metadata">

### Author: ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forums.rocket.chat/u/bape)
#### Post date: [August 13, 2021, 11:22am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/5 "2021-08-13T11:22:14Z")

</div>

Thx! That was the trick!

---

<div class="post-metadata">

### Author: ![bape](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bape](https://forums.rocket.chat/u/bape)
#### Post date: [August 13, 2021, 11:55am UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/6 "2021-08-13T11:55:30Z")

</div>

Where I can edit this url? It is pointing to localhost now?

 ![Screenshot 2021-08-13 at 13.53.53](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/7/753e1e1f1a4c721d8c7fe8ae03ae268ef743d712.png)

---

<div class="post-metadata">

### Author: ![debdut.chakraborty](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/debdut.chakraborty/32/2900_2.png) [@debdut.chakraborty](https://forums.rocket.chat/u/debdut.chakraborty)
#### Post date: [August 13, 2021, 5:37pm UTC](https://forums.rocket.chat/t/images-links-are-not-correct-using-nginx-reverse-proxy/11913/7 "2021-08-13T17:37:55Z")

</div>

> [@bape](#):
>
> It is pointing to localhost now?

I don’t know. What was the previous site url?

> [@bape](#):
>
> Where I can edit this url?

You’re going to need to update the database directly. How to connect to the daemon, the name of the database - depends on the deployment method.

An example query would look like the following -

```javascript
db.rocketchat_uploads.find({}).forEach(function(cursor) {
    cursor.url = cursor.url.replace(`^${ RegExp([OLD_SITE_URL]) }\/`, "[NEW_SITE_URL]/");
    db.rocketchat_uploads.save(cursor);
})

```

Granted that I’m not the best (or experienced) at writing MQL queries, without knowing the version of your mongo server, I can’t recommend anything less generic any way. For example you could use `updateMany`, but that’s only available starting version 4.2

Finally, before you attempt to use it, **PLEASE PLEASE PLEASE** back up your existing data FIRST.

If you need more help, surely let me know 🙂
