2

I am getting 403 "invalid host specified"

Running geth this way:

docker run --rm -p 8547:8547 -p 30303:30303 --name=geth -dti -v /data/geth:/data ethereum-node --datadir=/data --http --http.addr="0.0.0.0" --http.port="8547" --calaveras --http.api="eth,debug" --http.corsdomain="*"

My nginx is setup this way:

server {
        root /var/www/website.com;

        index index.html;

        server_name website.com;
        error_page 404 = /404.html;

        location / {
                try_files $uri $uri/ =404;
        }

        location /rpc {
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass    http://127.0.0.1:8547/;
        }

        location /404.html {
                internal;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
}

Connecting to Web3 this way:

const web3 = new Web3('https://website.com/rpc);

What else can I try?

1 Answer 1

0
server {
        root /var/www/website.com;

        index index.html;

        server_name website.com;
        error_page 404 = /404.html;

        location / {
                try_files $uri $uri/ =404;
        }

        location /rpc {
                proxy_pass    http://127.0.0.1:8547/;
        }

        location /404.html {
                internal;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.