<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy" -->

---
title: Why and how we ‘stringified’ your API gateway policies
description: Ngrok replaced its highly typed Traffic Policy configuration structs in the agent and SDKs with plain YAML/JSON strings. This 'stringification' removes the...
canonical: https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why and how we ‘stringified’ your API gateway policies | daily.dev
og:description: Ngrok replaced its highly typed Traffic Policy configuration structs in the agent and SDKs with plain YAML/JSON strings. This 'stringification' removes the...
og:url: https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy
og:image: https://api.daily.dev/og/posts/dvZFQIAlY.png
og:image:alt: Why and how we ‘stringified’ your API gateway policies
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why and how we ‘stringified’ your API gateway policies

**[ngrok Blog](https://daily.dev/sources/ngrok)** · 5 min read · 0 upvotes · 0 comments

## Summary

Ngrok replaced its highly typed Traffic Policy configuration structs in the agent and SDKs with plain YAML/JSON strings. This 'stringification' removes the need to release new SDK/agent versions across Go, Rust, Python, Java, and JavaScript every time a policy field changes, and avoids breaking existing user configs. The old typed configuration (e.g. PolicyString) is replaced by a new traffic_policy field (e.g. WithTrafficPolicy() in the Go SDK), which accepts raw string policy documents validated server-side. Existing configurations continue to work via a backend translation layer, but users are encouraged to migrate to the new string-based format, since new backend features become instantly available to any agent supporting the traffic_policy field without needing an SDK upgrade.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://ngrok.com/blog/traffic-policy-string>

## Questions this post answers

### How do I configure ngrok Traffic Policy rules with the Go SDK now instead of using typed policy structs?

Use the WithTrafficPolicy() function, which accepts a plain YAML or JSON string instead of the old typed PolicyString structure. The policy field was also renamed to traffic_policy across agents and SDKs. This lets you store rules in a separate YAML/JSON file rather than hardcoding typed rule structs into your app.

_Track SDK config changes like ngrok's traffic_policy string migration by following backend tooling updates on daily.dev._

### Will updating my ngrok agent or SDK version break my existing Traffic Policy configuration?

No, older typed Traffic Policy configurations continue to work after agent or SDK updates because ngrok validates policy server-side and applies a translation layer for incoming tunnel start requests. Migrating to the new string-based traffic_policy format is recommended but not required immediately, since new backend features are only automatically available to agents using the new field.

_Developers weighing when to migrate API gateway configs can follow breaking-change writeups like this on daily.dev._

### Why did ngrok change Traffic Policy from typed configuration structs to raw JSON or YAML strings?

Typed structs required releasing updates across the Go, Rust, Python, Java, and JavaScript SDKs every time a policy field or phase changed, and any renamed field (like inbound to on_http_request) could break hardcoded user configurations. Switching to string-based policies validated server-side lets new backend features reach all agents immediately without SDK version bumps.

_Engineers deciding how to design SDK config interfaces can compare real migration rationale like this on daily.dev._

---

Tags: [#devtools](https://daily.dev/tags/devtools), [#backend](https://daily.dev/tags/backend), [#golang](https://daily.dev/tags/golang), [#api-gateway](https://daily.dev/tags/api-gateway)

[View this post on daily.dev](https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Why and how we ‘stringified’ your API gateway policies","url":"https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy"},"datePublished":"2026-08-23T07:21:21.069Z","dateModified":"2026-08-23T07:28:44.792Z","description":"Ngrok replaced its highly typed Traffic Policy configuration structs in the agent and SDKs with plain YAML/JSON strings. This 'stringification' removes the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/38baae32b0e2141858b2209fa13b8015?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/38baae32b0e2141858b2209fa13b8015?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"ngrok Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ngrok Blog","logo":"https://media.daily.dev/image/upload/s--718XXxvE--/f_auto,q_auto/v1787469610/logos/ngrok?_a=BAMAMicg0","url":"https://daily.dev/sources/ngrok"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"devtools,backend,golang,api-gateway","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ngrok Blog","item":"https://daily.dev/sources/ngrok"},{"@type":"ListItem","position":3,"name":"Why and how we ‘stringified’ your API gateway policies"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/why-and-how-we-stringified-your-api-gateway-policies-dvzfqialy#faq","mainEntity":[{"@type":"Question","name":"How do I configure ngrok Traffic Policy rules with the Go SDK now instead of using typed policy structs?","acceptedAnswer":{"@type":"Answer","text":"Use the WithTrafficPolicy() function, which accepts a plain YAML or JSON string instead of the old typed PolicyString structure. The policy field was also renamed to traffic_policy across agents and SDKs. This lets you store rules in a separate YAML/JSON file rather than hardcoding typed rule structs into your app. Track SDK config changes like ngrok's traffic_policy string migration by following backend tooling updates on daily.dev."}},{"@type":"Question","name":"Will updating my ngrok agent or SDK version break my existing Traffic Policy configuration?","acceptedAnswer":{"@type":"Answer","text":"No, older typed Traffic Policy configurations continue to work after agent or SDK updates because ngrok validates policy server-side and applies a translation layer for incoming tunnel start requests. Migrating to the new string-based traffic_policy format is recommended but not required immediately, since new backend features are only automatically available to agents using the new field. Developers weighing when to migrate API gateway configs can follow breaking-change writeups like this on daily.dev."}},{"@type":"Question","name":"Why did ngrok change Traffic Policy from typed configuration structs to raw JSON or YAML strings?","acceptedAnswer":{"@type":"Answer","text":"Typed structs required releasing updates across the Go, Rust, Python, Java, and JavaScript SDKs every time a policy field or phase changed, and any renamed field (like inbound to on_http_request) could break hardcoded user configurations. Switching to string-based policies validated server-side lets new backend features reach all agents immediately without SDK version bumps. Engineers deciding how to design SDK config interfaces can compare real migration rationale like this on daily.dev."}}]}
```

