Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

With Traffic Policy, you can connect your API to ngrok’s log exporting system for smarter troubleshooting, testing, and integration of logging services like Datadog for your API gateway and upstream services. This rule:
  1. Checks if the response status code is not in the 200 range
  2. Logs the unsuccessful request with a custom message and metadata
on_http_request:
- actions:
  - type: custom-response
    config:
      status_code: 503
      body: "<html><body><h1>Service Unavailable</h1><p>Our servers are currently
        down for maintenance. Please check back later.</p></body></html>"
      headers:
        content-type: text/html
on_http_response:
- name: Log unsuccessful requests
  expressions:
  - res.status_code < '200' && res.status_code >= '300'
  actions:
  - type: log
    config:
      metadata:
        message: Unsuccessful request
        edge_id: "<YOUR-NGROK-DOMAIN>"
        success: false
See the log Traffic Policy action docs for more information.