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

nginx config example #71

Closed
markc opened this issue Oct 21, 2022 · 2 comments · Fixed by #108
Closed

nginx config example #71

markc opened this issue Oct 21, 2022 · 2 comments · Fixed by #108

Comments

@markc
Copy link

markc commented Oct 21, 2022

I presume headscale-ui could be run via nginx, so any possibility of a config example?

@sarog
Copy link

sarog commented Oct 31, 2022

map $http_upgrade $connection_upgrade {
    default      keep-alive;
    'websocket'  upgrade;
    ''           close;
}

server {
    server_name headscale-01.example.com;

    location /web {
        alias /usr/local/www/headscale-ui;
        index index.html;
    }

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $server_name;
        proxy_redirect http:// https://;
        proxy_buffering off;
        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 $http_x_forwarded_proto;
        add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
    }

    listen 443 ssl;
    ssl_certificate fullchain.pem;
    ssl_certificate_key privkey.pem;
    [...]
}

server {
    if ($host = headscale-01.example.com) {
        return 301 https://$host$request_uri;
    }

    server_name headscale-01.example.com;
    listen 80;
    return 404;
}

@routerino routerino linked a pull request Jun 25, 2023 that will close this issue
@PureTryOut
Copy link

That just points nginx directly to the web files. Is there also a way to let nginx be the proxy and handle the SSL stuff and just run headscale-ui in a separate container? That way nginx has no access to the files so I can't just do the alias thing, but because it also handles the SSL I can't just proxy it to the headscale-ui container either as that configures SSL with a self-signed certificate and then complains a HTTP request has been sent to an HTTPS server.

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

Successfully merging a pull request may close this issue.

3 participants