In my case i am running mopidy-party as guest-mode and mopidy-mobile as DJ-mode.
Access to mopidy-party with lan IP only (without port number).
Access to mopidy-mobile is restricted with login.
I realized this with nginx in conjunction with iptables and that worked over the last 2 years without
any troubles.
My config:
server {
listen 80 default_server;
server_name _;
location /mobile {
proxy_pass http://localhost:6680;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location / {
proxy_buffering off;
proxy_pass http://localhost:6680;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
rewrite /mopidy/(.*) /mopidy/$1 break;
rewrite /(.*) /party/$1 break;
proxy_redirect off;
}
}
iptables drops port 6680.
works with below environment:
debian stretch
nginx: 1.10.3
mopidy 2.2.3
mopidy-spotify; 3.1.0
mopidy-party: 0.3.1
mopidy-mobile: 1.9.0
The issue now is, that the clients are loading the right pages, ask for credentials but at this stage
booth extension (party, mobile) are hanging (trying to connect without success).
Nginx error.log:
2020/05/20 17:57:25 [error] 799#799: *44 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.11, server: _, request: “GET /mopidy/ws HTTP/1.1”, upstream: “http://[::1]:6680/mopidy/ws”, host: “10.0.0.41”
root@rpi4:~# cat /var/log/nginx/error.log
2020/05/20 17:57:25 [error] 799#799: *44 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.11, server: _, request: “GET /mopidy/ws HTTP/1.1”, upstream: “http://[::1]:6680/mopidy/ws”, host: “10.0.0.41”
2020/05/20 17:57:44 [error] 800#800: *41 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.11, server: _, request: “GET /vendors/fontawesome-all.min.css HTTP/1.1”, upstream: “http://[::1]:6680/party/vendors/fontawesome-all.min.css”, host: “10.0.0.41”, referrer: “http://10.0.0.41/”
2020/05/20 17:57:45 [error] 799#799: *39 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.11, server: _, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://[::1]:6680/party/favicon.ico”, host: “10.0.0.41”
mopidy.log:
2020-05-20 18:11:02,509 INFO [843:HttpServer] tornado.access: 304 GET /party/ (127.0.0.1) 3.12ms
2020-05-20 18:11:02,559 INFO [843:HttpServer] tornado.access: 200 GET /party/vendors/fontawesome-all.min.css (127.0.0.1) 4.37ms
2020-05-20 18:11:02,565 INFO [843:HttpServer] tornado.access: 200 GET /party/style.css (127.0.0.1) 3.07ms
2020-05-20 18:11:02,572 INFO [843:HttpServer] tornado.access: 200 GET /party/vendors/mopidy.min.js (127.0.0.1) 4.03ms
2020-05-20 18:11:02,583 INFO [843:HttpServer] tornado.access: 200 GET /party/controller.js (127.0.0.1) 3.27ms
2020-05-20 18:11:02,595 INFO [843:HttpServer] tornado.access: 200 GET /party/vendors/bootstrap.min.css (127.0.0.1) 46.59ms
2020-05-20 18:11:02,596 INFO [843:HttpServer] tornado.access: 200 GET /party/vendors/angular.min.js (127.0.0.1) 21.63ms
2020-05-20 18:11:02,649 WARNING [843:HttpServer] tornado.access: 404 GET /party/favicon.ico (127.0.0.1) 1.09ms
2020-05-20 18:11:10,546 INFO [843:HttpServer] tornado.access: 200 GET /mobile/index.html (127.0.0.1) 2.69ms
2020-05-20 18:11:10,594 INFO [843:HttpServer] tornado.access: 200 GET /mobile/css/ionic-light.min.css?v=1.9.1 (127.0.0.1) 7.34ms
2020-05-20 18:11:10,707 INFO [843:HttpServer] tornado.access: 200 GET /mobile/images/icon-192x192.png?v=1.9.1 (127.0.0.1) 2.87ms
2020-05-20 18:11:32,487 WARNING [843:HttpServer] mopidy.http.handlers: HTTP request denied for Origin “http://10.0.0.41”
2020-05-20 18:11:32,488 WARNING [843:HttpServer] tornado.access: 403 GET /mopidy/ws (127.0.0.1) 2.71ms
2020-05-20 18:12:32,497 WARNING [843:HttpServer] mopidy.http.handlers: HTTP request denied for Origin “http://10.0.0.41”
2020-05-20 18:12:32,499 WARNING [843:HttpServer] tornado.access: 403 GET /mopidy/ws (127.0.0.1) 2.71ms
The changelogs of mopidy said, that the version of torpedo have changed from 4.x to 5.x.
Could this be the reason?
Is it possible that mopidy has it’s own redirect/forward function which interferes with nginx?
The question for me now is, where and how should i start examining the problem?
Many Thanks in Advance.