Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web UI Authentication #457

Open
9M2PJU opened this issue Aug 6, 2024 · 4 comments
Open

Web UI Authentication #457

9M2PJU opened this issue Aug 6, 2024 · 4 comments

Comments

@9M2PJU
Copy link

9M2PJU commented Aug 6, 2024

I tried to add http authentication using nginx and reverse from port 80 to port 8080 to pat,

but this error occurs

2024/08/06 22:47:01 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
2024/08/06 22:47:05 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
2024/08/06 22:47:11 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
2024/08/06 22:47:16 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
2024/08/06 22:47:39 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
2024/08/06 22:47:44 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header

Is there any plan to include authentication to pat web ui in future ?

@9M2PJU 9M2PJU closed this as completed Aug 6, 2024
@martinhpedersen
Copy link
Member

Hi,

I guess you got it working since you closed this issue? 😊

If not, please have a look at #159 (comment).

@9M2PJU
Copy link
Author

9M2PJU commented Aug 6, 2024

Hi,

I guess you got it working since you closed this issue? 😊

If not, please have a look at #159 (comment).

Thanks. Tried but still no logs at the bottom of the page.

image

It showed red color button instead of green.

image

This is my nginx config

server {
listen 7373;

# Allow large body sizes (image uploads)
client_max_body_size 12m;

# Basic authentication
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;

location /ws {
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;
    proxy_set_header        Upgrade $http_upgrade;
    proxy_set_header        Connection "upgrade";

    proxy_http_version 1.1;
    proxy_pass         http://localhost:8888/ws;
    proxy_read_timeout  300;
}

location / {
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;

    proxy_http_version  1.1;
    proxy_pass          http://localhost:8888;
    proxy_read_timeout  300;

    proxy_redirect      http://localhost:8888 http://$host;
}

}

@9M2PJU 9M2PJU reopened this Aug 6, 2024
@r1de
Copy link

r1de commented Nov 8, 2024

Hi,

I guess you got it working since you closed this issue? 😊

If not, please have a look at #159 (comment).

This does not work.
Cannot get to the websocket via the reverse proxy.
I have seemingly tried everything in the nginx config file.
Not even trying to use https, just want a password on the site.

current nginx config:

server {
        listen 8080;
        auth_basic "Restricted Access";
        auth_basic_user_file /etc/nginx/.htpasswd-kg6wxc;

        client_max_body_size 12m;

        location /ws {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";

                proxy_http_version 1.1;

                proxy_pass http://127.0.0.1:7777/ws;

        }
        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;

                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_http_version 1.1;

                proxy_pass http://127.0.0.1:7777;

                proxy_redirect http://127.0.0.1:7777 http://kg6wxc-mail.local.mesh:8080;
    }
}

Edit* getting a 403 error for /ws, any ideas?

@r1de
Copy link

r1de commented Nov 10, 2024

on the PAT console is the clue: websocket: request origin not allowed by Upgrader.CheckOrigin
But it is still unsure how to get nginx to play nice with the websocket, any one have any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants