How to use nginx proxy

Hello, i have a question, how to use nginx proxy infura webstock server. thx.

Hi @11116, welcome to the our community! Can you provide some additional information about what you are trying to do? If you have a diagram that could help as well.

Hi @mike, i’m in china. due to network firewall problems. ensure service is available. so must use nginx proxy to infura.io . but fail.
How should it be set up? This is my problem.

Hi @11116 . You can follow the standard process for configuring a reverse proxy upstream in the NGINX docs.

For the upstream use your Infura endpoint containing your project id (e.g. https://mainnet.infura.io/v3/[projectid])

Hi @egalano. I tried it, but I got ‘forbidden’.

server {
        listen 443;
        ssl     on;
        server_name     infura.example.com;
        ssl_certificate     ssl/infura.crt;
        ssl_certificate_key ssl/infura.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
                proxy_pass https://ropsten.infura.io/v3/[projectid];
                proxy_http_version 1.1;
                proxy_read_timeout 360s;
                proxy_redirect off;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host:$server_port;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header REMOTE-HOST $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

You need to add one more header for the request to be properly authenticated. Please add:
proxy_set_header Host ropsten.infura.io or if you are planning on targeting mainnet use proxy_set_header Host mainnet.infura.io

@egalano, thank you very mach, https proxy is worked. how to set up webstock proxy? thank you.

Do you mean websocket proxy? Unfortunately, setting up a third party websocket proxy is not something we currently support for reliability reasons.

ok, thank you very much.