Reverse proxy - configurations does not work

i’m running mopidy on armbian with:

mopidy --version
Mopidy 3.3.0

i would like to provide mopidy on another port like 80, for testing purposes i tried 8091…

i tried different settings:

server {
        listen 8091;
        server_name  _;

        access_log /var/log/nginx/access_8091.log;
        error_log /var/log/nginx/error_8091.log debug;

        proxy_http_version 1.1;
        proxy_read_timeout 600s;

        location / {
                proxy_pass http://10.100.10.181:6680/;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_connection;
        }
}
server {
        listen 8091;
        # Set to "_" to listen to all domains
        server_name  _;

        access_log /var/log/nginx/access_8091.log;
        error_log /var/log/nginx/error_8091.log debug;

        proxy_http_version 1.1;
        proxy_read_timeout 600s;

    location /mopidy/ws {
        proxy_pass http://10.100.10.181:6680;
        proxy_http_version 1.1;
        proxy_set_header        Upgrade $http_upgrade;
        proxy_set_header        Connection $http_connection;
    }


        location / {
                proxy_pass http://10.100.10.181:6680/;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $http_connection;
        }
}

also with 127.0.0.01 it does not help it results in:

Sep 27 15:08:01 RadballKidZ mopidy[7760]: WARNING  2022-09-27 15:08:01,326 [7760:HttpServer] mopidy.http.handlers
Sep 27 15:08:01 RadballKidZ mopidy[7760]:   HTTP request denied for Origin "http://10.100.10.181:8091"

i tried:

allowed_origins =
  10.100.10.181:8091

without success…

nginx logfile:

Upgrade: websocket
Connection: Upgrade
Host: 10.100.10.181:6680
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Origin: http://10.100.10.181:8091
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: _ga=GA1.1.487800204.1662367306; _gid=GA1.1.544731325.1664266227; _gat=1
Sec-WebSocket-Key: vZmChUzBd+qBnMOuILpQvQ==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http cleanup add: 00BF3160
2022/09/27 14:57:28 [debug] 12257#12257: *17 get rr peer, try: 1
2022/09/27 14:57:28 [debug] 12257#12257: *17 stream socket 30
2022/09/27 14:57:28 [debug] 12257#12257: *17 epoll add connection: fd:30 ev:80002005
2022/09/27 14:57:28 [debug] 12257#12257: *17 connect to 10.100.10.181:6680, fd:30 #18
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream connect: -2
2022/09/27 14:57:28 [debug] 12257#12257: *17 posix_memalign: 00BA5150:128 @16
2022/09/27 14:57:28 [debug] 12257#12257: *17 event timer add: 30: 60000:25063973
2022/09/27 14:57:28 [debug] 12257#12257: *17 http finalize request: -4, "/mopidy/ws/?" a:1, c:2
2022/09/27 14:57:28 [debug] 12257#12257: *17 http request count:2 blk:0
2022/09/27 14:57:28 [debug] 12257#12257: *17 http run request: "/mopidy/ws/?"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream check client, write event:1, "/mopidy/ws/"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream request: "/mopidy/ws/?"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream send request handler
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream send request
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream send request body
2022/09/27 14:57:28 [debug] 12257#12257: *17 chain writer buf fl:1 s:607
2022/09/27 14:57:28 [debug] 12257#12257: *17 chain writer in: 00BF3190
2022/09/27 14:57:28 [debug] 12257#12257: *17 writev: 607 of 607
2022/09/27 14:57:28 [debug] 12257#12257: *17 chain writer out: 00000000
2022/09/27 14:57:28 [debug] 12257#12257: *17 event timer del: 30: 25063973
2022/09/27 14:57:28 [debug] 12257#12257: *17 event timer add: 30: 600000:25603973
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream request: "/mopidy/ws/?"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http upstream process header
2022/09/27 14:57:28 [debug] 12257#12257: *17 malloc: 00BF4368:4096
2022/09/27 14:57:28 [debug] 12257#12257: *17 recv: eof:0, avail:-1
2022/09/27 14:57:28 [debug] 12257#12257: *17 recv: fd:30 185 of 4096
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy status 403 "403 Forbidden"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy header: "Server: TornadoServer/6.1"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy header: "Content-Type: text/html; charset=UTF-8"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy header: "Date: Tue, 27 Sep 2022 12:57:28 GMT"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy header: "Content-Length: 35"
2022/09/27 14:57:28 [debug] 12257#12257: *17 http proxy header done
2022/09/27 14:57:28 [debug] 12257#12257: *17 xslt filter header
2022/09/27 14:57:28 [debug] 12257#12257: *17 HTTP/1.1 403 Forbidden
Server: nginx/1.18.0
Date: Tue, 27 Sep 2022 12:57:28 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip

does anybody has an idea how to solve ?

thanks a lot

Lars

How are you running Mopidy? Can you please double check your are editing the correct config file for the way you are running Mopidy, as outlined at Running — Mopidy 3.3.0 documentation

And once that’s confirmed, you can try temporarily setting http/csrf_protection = false to see if that has an impact, it will disable all origin checking. It’s not a good long-term solution but worth checking. Mopidy-HTTP — Mopidy 3.3.0 documentation

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.