Why is ngrok returning HTML?

September 06, 2022 •

☕️

1 min read

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';