I currently have a node running on the cloud and I've set its websocket port to a custom domain following Polkadot's Nginx config (here). I would like to be able to use this node as a bootnode for other nodes in the future. Ideally, I would like to use my custom domain instead of the node's IP. While following yet another Polkadot tutorial (here) I modified my nginx configuration to the following:
server {
server_name {CUSTOM_DOMAIN};
root /var/www/html;
index index.html;
location / {
proxy_buffering off;
proxy_pass http://localhost:30333;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ws {
proxy_buffering off;
proxy_pass http://localhost:9944;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/cloudflare.crt;
ssl_certificate_key /etc/ssl/certs/cloudflare.pem;
ssl_session_cache shared:cache_nginx_SSL:1m;
ssl_session_timeout 1440m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
}
I can successfully use my custom domain to access the WebSocket stuff, but when trying to use it for the p2p stuff it does not work.
I've tried setting the --public-addr
parameter to my custom domain, running the bootnode like:
./path/to/binary --chain ./chainSpecRaw.json --base-path /tmp/node \
--ws-external --rpc-external --rpc-cors all --name "Bootnode 1" --pruning archive \
--public-addr="/dns/{CUSTOM_DOMAIN}/tcp/443/p2p/{PEER_ID}"
But when I try to run a new node as:
./target/release/contractuo-chain-node --chain ./chainSpecRaw.json --base-path /tmp/node \
--name "Test Node" --ws-external --rpc-external --rpc-cors all \
--bootnodes "/dns/{CUSTOM_DOMAIN}/tcp/443/p2p/{PEER_ID}"
It does not manage to find the bootnode. But if I swap the param to --bootnodes "/ip4/{CLOUD_IP}/tcp/30333/ws/p2p/{PEER_ID}"
then it connects successfully.
Anyway, I don't know if I'm missing something on the nginx side, or on the node configuration, but I would like to be able to connect the nodes using my custom domain rather than the ip address.
dig {CUSTOM_DOMAIN}
from the node within this nginx instance? Perhaps DNS isn't working properly.