# Host dash under alternate path

**URL:** https://community.plotly.com/t/host-dash-under-alternate-path/21237
**Category:** Dash Python
**Created:** [March 21, 2019, 11:10pm UTC](https://community.plotly.com/t/host-dash-under-alternate-path/21237 "2019-03-21T23:10:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dfrey](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@dfrey](https://community.plotly.com/u/dfrey)
#### Post date: [March 21, 2019, 11:10pm UTC](https://community.plotly.com/t/host-dash-under-alternate-path/21237/1 "2019-03-21T23:10:27Z")

</div>

Say I have a website http://example\_dot\_com and I want to use Dash to show some nice graphs. I want to host these graphs under http://example\_dot\_com/cool\_data. I don’t want to re-build my entire website using dash. I was thinking that I could use nginx to specify a proxy such that /cool\_data goes to host\_running\_dash:8050. I have gotten that part working using this slightly adapted example from the gunicorn website:

```auto
  server {
    listen 80;
    server_name example_dot_com;

    location /cool_data {
        proxy_pass http://127.0.0.1:8050;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  }

```

The problem now is that the client is making requests for things like `/_dash-dependencies` and `/_dash-layout` rather than `/cool_data/_dash-dependencies`. I’m assuming that these requests are based on the content that is being returned when http://example\_dot\_com/cool\_data is visited. Is there any way to inform Dash that it’s being hosted under a different URL? Or is my strategy here totally wrong?

---

<div class="post-metadata">

### Author: ![nedned](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nedned/32/8795_2.png) [@nedned](https://community.plotly.com/u/nedned)
#### Post date: [March 22, 2019, 4:50am UTC](https://community.plotly.com/t/host-dash-under-alternate-path/21237/2 "2019-03-22T04:50:03Z")

</div>

Hey, welcome to the forums!

Yep, there’s a `Dash` class initialisation parameter for changing the request URL prefixes, for just this situation.

Dash has both `requests_pathname_prefix` and `routes_pathname_prefix`. By adding the prefix in nginx, you have effectively set `routes_pathname_prefix` to be `/cool_data`. So now you need to changed `requests_pathname_prefix` to match this.

---

<div class="post-metadata">

### Author: ![dfrey](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@dfrey](https://community.plotly.com/u/dfrey)
#### Post date: [March 26, 2019, 6:53pm UTC](https://community.plotly.com/t/host-dash-under-alternate-path/21237/3 "2019-03-26T18:53:35Z")

</div>

Thanks for your response @nedned. I ended up with this:

```auto
pathname_params = dict()
if my_settings.hosting_path is not None:
    pathname_params["routes_pathname_prefix"] = "/"                                                                                                                                                                                                                              
    pathname_params["requests_pathname_prefix"] = "/{}/".format(my_settings.hosting_path)                                                                                                                                                                                   
app = dash.Dash( __name__ , external_stylesheets=external_stylesheets, server=server, **pathname_params)

```

---

<div class="post-metadata">

### Author: ![nedned](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nedned/32/8795_2.png) [@nedned](https://community.plotly.com/u/nedned)
#### Post date: [March 26, 2019, 10:49pm UTC](https://community.plotly.com/t/host-dash-under-alternate-path/21237/4 "2019-03-26T22:49:44Z")

</div>

Great!

You can also omit setting `routes_pathname_prefix`, you just need to set `requests_pathname_prefix`
