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

Fix https issue once and for all #218

Open
OmniTroid opened this issue Mar 3, 2024 · 0 comments
Open

Fix https issue once and for all #218

OmniTroid opened this issue Mar 3, 2024 · 0 comments

Comments

@OmniTroid
Copy link
Contributor

OmniTroid commented Mar 3, 2024

As we know, one of the most reported issues in webAO remains the "please remove the s from https" error, which occurs when https and ws (insecure websocket) is used on web.aceattorneyonline.com. This is a quite serious usability issue, and many browsers make it hard to modify the http protocol in the address bar.

In order to fix this properly and robustly, webAO needs to be hosted on a proper, configurable webserver (not github pages). Assuming an ssh key is set up correctly on the machine, this deployment is very simple using rsync:
npm run build && rsync -av --delete dist/ server:/var/www/webao/

Furthermore, nginx can be configured as follows to always instruct the client correctly in terms of protocols:

server {
        listen 80;
        server_name web.aceattorneyonline.com;

        location / {
                # If the client is connecting on http and with wss, upgrade to https
                if ($arg_connect ~* (wss:)) {
                        return 302 https://$host$request_uri;
                }

                root /var/www/webao;
                index index.html;
        }
}

server {
        listen 443 ssl;
        server_name web.aceattorneyonline.com;

        ssl_certificate /var/cert/web.aceattorneyonline.com/fullchain.pem;
        ssl_certificate_key /var/cert/web.aceattorneyonline.com/privkey.pem;

        location / {
                # If the client is connecting on https and with ws, downgrade to http
                if ($arg_connect ~* (ws:)) {
                        return 302 http://$host$request_uri;
                }

                root /var/www/webao;
                index index.html;
        }
}

It should be quite straightforward to configure this behind a CDN (eg. cloudflare) as well.

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

1 participant