# Rancher behind nginx reverse proxy location

**URL:** <https://forums.suse.com/t/rancher-behind-nginx-reverse-proxy-location/15617>\
**Category:** SUSE Rancher Prime\
**Created:** [October 23, 2019, 2:25pm UTC](https://forums.suse.com/t/rancher-behind-nginx-reverse-proxy-location/15617 "2019-10-23T14:25:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![admiraludon6](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@admiraludon6](https://forums.suse.com/u/admiraludon6)\
**Post date:** [October 23, 2019, 2:25pm UTC](https://forums.suse.com/t/rancher-behind-nginx-reverse-proxy-location/15617/1 "2019-10-23T14:25:00Z")

</div>

Hi ,

Can someone help me , I’m tried to setup Rancher behind Nginx reverse proxy .  
I already look into

> [https://rancher.com/docs/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/#example-nginx-config](https://rancher.com/docs/rancher/v2.x/en/installation/ha/helm-rancher/chart-options/#example-nginx-config)

The problem is… it only work under " / " location … I tried to do something like this :

> [https://www.example.com/rancher](https://www.example.com/rancher)

I have done some workaround using nginx … but i don’t think it’s good enough.

```
# Exact URI match to load the base rancher page without a redirect
location = /rancher {

    proxy_pass https://rancherhost:443; 
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
# Catch for all other rancher resources. Removes proxy URI before passing on
location /rancher {
    rewrite ^/rancher/(.*)$ /$1 break;

    proxy_pass https://rancherhost:443; 
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
# Catch for a stray rancher call that doesn't properly prepend the proxy URI
location ~ ^/(assets|v3|v3-public|translations|update-setting|engines-dist|login)/ {
    proxy_pass https://rancherhost:443; 
}

```

i’m using Rancher 2.x on docker container.
