# Nginx proxypass killing httpfrontend

**URL:** <https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692>\
**Category:** Misc\
**Created:** [January 8, 2020, 6:41am UTC](https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692 "2020-01-08T06:41:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FisherPric3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/fisherpric3/32/1393_2.png) [@FisherPric3](https://discourse.mopidy.com/u/FisherPric3)\
**Post date:** [January 8, 2020, 6:41am UTC](https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692/1 "2020-01-08T06:41:23Z")

</div>

So iv gotten quite a few extensions working how i want them including a few front end web gui’s but i would like to setup nginx to redirect port 80 to one front end and port 85 and 87(picked at random) to redirect to other front end extensions.

Right now iv got no issue using mopidy’s http server directly ip-address:6680/extension-name/ works great.

my goal is to eliminate the need for port 6680 and the directory traversal.  
i have used iptables to point port 80 at 6680 so i can get that part but the does not help me with the other extensions.  
i know you can set a default front end in the http config but that’s not the whole goal.

End game here wqould be  
-"ip-address:6680’ would take me to the regular mopidy page where you select a frontend  
-“ip-address” defaults to port 80 which goes to the extension 1 front end  
-“ip-address:85” goes to extension 2  
-“ip-address:87” goes to extension 3

Here is my mopidy config:  
[http]  
enabled = true  
hostname = 0.0.0.0  
port = 6680  
zeroconf = Mopidy HTTP server on $hostname  
allowed\_origins =  
csrf\_protection = true  
#default\_app = mopidy

# 

[audio]  
output = alsasink

# 

[spotify]  
username = \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
password = \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
client\_id = \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
client\_secret = \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

# 

[soundcloud]  
auth\_token = \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

# 

[musicbox\_webclient]  
enabled = true  
musicbox = false  
websocket\_host =  
websocket\_port =  
on\_track\_click = PLAY\_NEXT

and here is my nginx config:  
server {  
listen 80;

```
location / {
        proxy_pass http://127.0.0.1:6680/party/;
}

```

}

server {  
listen 85;

```
location / {
        proxy_pass http://127.0.0.1:6680/musicbox_webclient/;
}

```

}

server {  
listen 87;

```
location / {
        proxy_pass http://127.0.0.1:6680/mobile/;
}

```

}

these configs get me to the extensions but then there is no connection to mopidy after. like when i use the musicbox client it just says “trying to reach to mopidy at 127.0.0.1. Please wait” and the other extensions are completely unresponsive they load the web page but you cant interact with anything.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [January 8, 2020, 9:39am UTC](https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692/2 "2020-01-08T09:39:20Z")

</div>

You need something in those nginx config to handle the websocket that’s used for Mopidy’s RPC. I think there might be example nginx configs on here somewhereiif you search but I’m not familiar enough with it to give specifics here.

---

<div class="post-metadata">

**Author:** ![FisherPric3](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/fisherpric3/32/1393_2.png) [@FisherPric3](https://discourse.mopidy.com/u/FisherPric3)\
**Post date:** [January 8, 2020, 3:16pm UTC](https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692/3 "2020-01-08T15:16:11Z")

</div>

Ok. at least i have an identified problem. Unfortunately this is a little above my head. Is the a specific type of RPC web socket that mopidy uses that i can research nginx compatibility and configs for?

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [January 8, 2020, 4:17pm UTC](https://discourse.mopidy.com/t/nginx-proxypass-killing-httpfrontend/3692/4 "2020-01-08T16:17:21Z")

</div>

No, just a regular websocket. if you search on here you’ll find an example config at [[SOLVED] Websocket randomly reconnects when running Mopidy through a reverse SSH tunnel](https://discourse.mopidy.com/t/solved-websocket-randomly-reconnects-when-running-mopidy-through-a-reverse-ssh-tunnel/3079/6) and also at [Mopidy Raspberry Pi and Nginx](https://discourse.mopidy.com/t/mopidy-raspberry-pi-and-nginx/1026/2) and probably others if you look.
