1

On metamask, I want to connect to my private geth with SSL, because ios/android needs it.

server {

listen [::]:443 ssl ; # managed by Certbot
listen 443 ssl; # managed by Certbot


   ssl_certificate /etc/letsencrypt/live/mydomain.net/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/mydomain.net/privkey.pem;



include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
server_name mydomain.net;


location /rpc {
  proxy_redirect off;
  proxy_pass    http://mydomain.net:9000;
}

}

sudo systemctl start nginx with no error.

but on metamask, I cant connect to.

https://mydomain.com:9000 networkId: 2000

metamask says "Could not fetch chain ID. Is your RPC URL correct?"

1 Answer 1

0

Instead of using Nginx, this might be easier using Caddy web server that comes with Let's Encrypt integration. Here are some example configurations for Caddy.

Here is an example Caddyfile HTTPS/reverse proxy configuration for any EVM compatible node.

# Will automatically get TLS certificate for mynode.example.com
# on Caddy startup
# if your server DNS is configured properly 
mynode.example.com {

        # Add password protection
        # https://caddyserver.com/docs/caddyfile/directives/basicauth
        basicauth {
                admin JDJhJDE0JGEuVEZqOWp1QU9Jd0l5OTRFOW0wWU9wSlVBekd4UmNEM0w3eGFWekxBUEkvR1JRZkpZWmdh
        }

        reverse_proxy 127.0.0.1:8545

}

Some more examples of running nodes can be found in this repository.

Caddy can also do automatic TLS certificate (HTTPS) for your connection.

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.