Last active
June 12, 2023 02:04
-
-
Save zaru/82c487c67ee25b55a3bd4c9ba926850c to your computer and use it in GitHub Desktop.
ngrok + nginx proxy (keep alive)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream http_backend { | |
server example.ngrok.io; | |
keepalive 128; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /var/www/html; | |
server_name _; | |
client_max_body_size 20m; | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header Host example.ngrok.io; | |
proxy_set_header X-CSRF-Token $http_x_csrf_token; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
proxy_set_header Connection ""; | |
proxy_pass http://http_backend/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can't understand why but implicit proxy_pass via upstream doesn't work for me, so I used direct ngrok url instead. I also use https scheme, so my final configuration file is: