Why is ngrok returning HTML?
Nicolas Santos
Posted on September 7, 2022
Using ngrok for creating a proxy of your local backend is in every development journey, mostly when you want to expose a local service using an environment variable.
I found a problem that entertained me the whole afternoon while trying to deploy a Gmail Addon using Google App Script.
I couldn't make a request since the response returns HTML.
ngrok tries to ensure that if someone shares this URL with another part, this part knows that this URL is a tunnel to another endpoint.
The solution is straightforward. We should set ngrok-skip-browser-warning
in the headers of the response with any value, e.g
// Only for local development
headers['ngrok-skip-browser-warning'] = 'skip-browser-warning';
💖 💪 🙅 🚩
Nicolas Santos
Posted on September 7, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.