JustArchiNET / ASF-ui

The official web interface for ASF
Apache License 2.0
271 stars 38 forks source link

About the use of ASF in docker, Nginx reverse proxy, and the use of cloudflare after the log can not be displayed problem. #1615

Closed wyfang closed 1 year ago

wyfang commented 1 year ago

Checklist

ASF version

Latest stable release

ASF-ui version

5f9969b

Bug description

My question is the same as this one:https://github.com/JustArchiNET/ASF-ui/issues/1567

But I tried to close Early Hints and Rocket Loader according to the reply to this question, including my attempt to bypass cloudflare. but I got a new error message: WiFiShot 2022-11-28 at 17 21 06@2x

Expected behavior

I exprcted that I can see the log

Actual behavior

Websocket error! Error code: 1006

Steps to reproduce

No response

Possible reason/solution

No response

Can you help us with this bug report?

Somehow, I can test and offer feedback, but can't code

Global ASF.json config file

No response

BotName.json config of all affected bot instances

No response

Additional info

This is my reverse proxy profile, I don't know if it has anything to do with this:

server {
    listen 80;
    server_name asf.steam.pet;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/asf.steam.pet;

    location ~ /purge(/.*) {
        proxy_cache_purge cache_one $host$1$is_args$args;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_http_version 1.1;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Upgrade $http_upgrade;
    }

    include /www/server/panel/vhost/nginx/proxy/asf.steam.pet/*.conf;

    include enable-php-74.conf;

    include /www/server/panel/vhost/rewrite/asf.steam.pet.conf;

    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    location ~ \.well-known{
        allow all;
    }

    access_log  /www/wwwlogs/asf.steam.pet.log;
    error_log  /www/wwwlogs/asf.steam.pet.error.log;

    location / {
        proxy_pass http://127.0.0.1:1242;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
Aareksio commented 1 year ago

This is likely caused by nginx misconfiguration. Try adding the following properties to websocket endpoint (/api/nlog):

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Eg.

location /api/nlog {
    proxy_pass http://127.0.0.1:1242;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host:$server_port;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

There should be a detailed guide on how to set up nginx with ASF on the wiki too.

Aareksio commented 1 year ago

https://github.com/JustArchiNET/ArchiSteamFarm/wiki/IPC#can-i-use-asfs-ipc-behind-a-reverse-proxy-such-as-apache-or-nginx

MrBurrBurr commented 1 year ago

Closed due to inactivity