Giter Club home page Giter Club logo

ngrok-skip-browser-warning's Introduction

Preface

From the ngrok docs:

To block phishing attacks using our platform, ngrok has added an interstitial page for free accounts receiving requests from browsers. When a user visits an endpoint for the first time, ngrok will serve an interstitial page letting the user know that the content is served via ngrok and that they should not enter sensitive information unless they trust the person that sent them the link. Users should only see this page once per endpoint and it can be completely bypassed by adding the ngrok-skip-browser-warning header to your request.

It's tedious to add this header while developing a client for the API, which is exposed behind ngrok. In some cases, e.g. using EventSource, affecting the request headers seems to be impossible.

Solution

Add a forward proxy which will add the ngrok-skip-browser-warning header to all HTTP requests:

proxy

Usage

Run this image on the machine from where you are calling the ngrok endpoints:

$ docker run -d --rm -p 8080:80 -e NGROK_HOST=https://your-ngrok-domain.ngrok.io igops/ngrok-skip-browser-warning:latest

From now, use http://localhost:8080 as your API webroot.

Disclaimer

โš ๏ธ The purpose of this docker image is to ease your development process. Running a proxy locally does not facilitate phishing attacks until you expose your local network to the public. This image is provided "as is", without warranty of any kind, no matter what.

For more features, consider getting the ngrok subscription.

Customization

Feel free to replace /etc/nginx/nginx.conf with your own implementation, or use my config as a template in your managed nginx outside Docker.

A bare minimum nginx.conf for your experiments:

events {
    worker_connections 1024;
}
http {
    server {
        listen 80;
        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;

            # add more features you need
            # proxy_set_header ...
            
            # forward!
            proxy_pass https://your-ngrok-domain.ngrok.io;
        }
    }
}

Build a new image to test your conf:

FROM igops/ngrok-skip-browser-warning:latest
COPY my.conf /etc/nginx/nginx.conf

Run your variant:

$ docker run -d --rm -p 8080:80 -e NGROK_HOST=https://your-ngrok-domain.ngrok.io $(docker build -q /path/to/your/Dockerfile)

Feel free to contribute.

ENV variables

Variable Description
NGROK_HOST Mandatory. Your ngrok host, e.g. https://your-ngrok-domain.ngrok.io.
Specifying a protocol is optional, https will be used by default.
Any url parts after a domain name will be trimmed.

Source code

https://github.com/igops/ngrok-skip-browser-warning

Credits

@igops @muratx10

ngrok-skip-browser-warning's People

Contributors

igops avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.