DEV Community

Cover image for Why is ngrok returning HTML?
Nicolas Santos
Nicolas Santos

Posted on • Originally published at santosnicolas.com

Why is ngrok returning HTML?

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';
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
ttumejiaku profile image
TTUmejiaku

thank you so much for this.

Collapse
 
joebim profile image
Joseph Akinwole • Edited

Thank you for this. I'm having this issue too

Pls what headers are you talking about