TL;DR; For those still curious about how to automate a workaround, I've created a docker image which runs a simple HTTPS proxy locally and adds ngrok-skip-browser-warning
header to each request.
Run:
$ docker run -d --rm \
-p 8443:443 \
-p 8080:80 \
-e NGROK_HOST=https://your-ngrok-domain.ngrok.io \
igops/ngrok-skip-browser-warning:latest
From now, use https://ngrok.localhost.direct:8443
as your API webroot.
E.g., you were told to call GET https://your-ngrok-domain.ngrok.io/api/v1/whatever
. Now you just call GET https://ngrok.localhost.direct:8443/api/v1/whatever
instead, and get the response without the warning page!
*.localhost.direct
is a wildcard record of the public DNS pointing to 127.0.0.1
.
Read more
The main idea under the hood is running Nginx with the following config:
server {
server_name localhost ngrok.localhost.direct;
listen 80;
listen 443 ssl;
ssl_certificate /etc/nginx/certs/localhost.direct.crt;
ssl_certificate_key /etc/nginx/certs/localhost.direct.key;
location / {
# regular forwarding headers
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host your-ngrok-domain.ngrok.io;
# this line does the actual trick
proxy_set_header ngrok-skip-browser-warning 1;
# forward!
proxy_pass https://your-ngrok-domain.ngrok.io;
}
}
Feel free to use.