Skip to content

ngrok-samples/office-hours-013-cheatsheet

Repository files navigation

Office Hours #013

Demo File 1: serve-1.js

node serve-1.js

Demo File 2: serve-2.js

node serve-2.js

In Order of Appearance

Custom Response

Link: https://ngrok.com/docs/traffic-policy/actions/custom-response/

Note

The Custom Response Traffic Policy action enables you to return a hard-coded response back to the client that made a request to your endpoint.

Traffic Policy File: 00-custom-response.yaml

ngrok http 8080 --traffic-policy-file 00-custom-response.yaml

Basic Authentication

Link: https://ngrok.com/docs/traffic-policy/actions/basic-auth/

Note

The Basic Auth Traffic Policy action enables you to enforce HTTP Basic Auth on your endpoints. Requests with a valid username and password will be sent to your upstream service, all others will be rejected with a 401 Unauthorized response.

Traffic Policy File: 01-basic-auth.yaml

ngrok http 8080 --traffic-policy-file 01-basic-auth.yaml

OAuth

Link: https://ngrok.com/docs/traffic-policy/actions/oauth/

Note

The OAuth Traffic Policy action restricts access to only authorized users by enforcing OAuth through an identity provider of your choice.

Traffic Policy File: 02-oauth.yaml

ngrok http 8080 --traffic-policy-file 02-oauth.yaml

Rate Limit

Note

The Rate Limit Traffic Policy action enables you to configure thresholds that restrict the throughput of traffic that successfully reaches your endpoint.

Traffic Policy File: 03-rate-limit.yaml

ngrok http 8080 --traffic-policy-file 03-rate-limit.yaml

Load Balancing

Note

When your create two endpoints with the same URL (and binding), those endpoints automatically form a "pool" and share incoming traffic.

ngrok http 8080 --url=[URL] --pooling-enabled
ngrok http 8081 --url=[URL] --pooling-enabled

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published