@@ -112,10 +112,14 @@ Implement the trait from `registry.rs` when your integration needs its own HTTP
112112``` rust
113113#[async_trait(? Send )]
114114impl IntegrationProxy for MyIntegration {
115+ fn integration_name (& self ) -> & 'static str {
116+ " my_integration"
117+ }
118+
115119 fn routes (& self ) -> Vec <IntegrationEndpoint > {
116120 vec! [
117- IntegrationEndpoint :: post (" /integrations/my-integration /auction" ),
118- IntegrationEndpoint :: get (" /integrations/my-integration /status" ),
121+ self . post (" /auction" ),
122+ self . get (" /status" ),
119123 ]
120124 }
121125
@@ -129,11 +133,20 @@ impl IntegrationProxy for MyIntegration {
129133}
130134```
131135
132- Routes are matched verbatim in ` crates/fastly/src/main.rs ` , so stick to stable paths
133- (` /integrations/<id>/… ` ) and register whichever HTTP methods you need. The shared context
134- already injects Trusted Server logging, headers, and error handling; the handler only
135- needs to deserialize the request, call the upstream endpoint, and stamp integration-specific
136- headers.
136+ ** Recommended:** Use the provided helper methods ` get() ` or ` post() `
137+ to automatically namespace your routes under ` /integrations/{integration_name()}/ ` .
138+ This lets you define routes with just their relative paths (e.g., ` self.post("/auction") ` becomes
139+ ` "/integrations/my_integration/auction" ` ). You can also define routes manually using
140+ ` IntegrationEndpoint::get() ` / ` IntegrationEndpoint::post() ` for backwards compatibility or
141+ special cases.
142+
143+ Routes are matched verbatim in ` crates/fastly/src/main.rs ` , so stick to stable paths and
144+ register whichever HTTP methods you need. ** New integrations should namespace their routes under
145+ ` /integrations/{INTEGRATION_NAME}/ ` ** using the helper methods (` self.get() ` or ` self.post() ` )
146+ for consistency, but you can define routes manually if needed (e.g., for backwards compatibility).
147+ The shared context already injects Trusted Server logging, headers,
148+ and error handling; the handler only needs to deserialize the request, call the upstream endpoint,
149+ and stamp integration-specific headers.
137150
138151#### Proxying upstream requests
139152
@@ -308,10 +321,12 @@ Prebid applies the same steps outlined above with a few notable patterns:
308321 ` settings.integrations.insert_config("prebid", &serde_json::json!({...})) ` , the same helper that
309322 other integrations use.
310323
311- 2 . ** Routes owned by the integration** – ` IntegrationProxy::routes ` declares the legacy
312- ` /first-party/ad ` (GET) and ` /third-party/ad ` (POST) endpoints. Both handlers share helpers that
313- shape OpenRTB payloads, inject synthetic IDs + geo/request-signing context, forward requests via
314- ` ensure_backend_from_url ` , and run the HTML creative rewrites before responding.
324+ 2 . ** Routes owned by the integration** – ` IntegrationProxy::routes ` declares the
325+ ` /integrations/prebid/first-party/ad ` (GET) and ` /integrations/prebid/third-party/ad ` (POST)
326+ endpoints. Both handlers share helpers that shape OpenRTB payloads, inject synthetic IDs +
327+ geo/request-signing context, forward requests via ` ensure_backend_from_url ` , and run the HTML
328+ creative rewrites before responding. All routes are properly namespaced under
329+ ` /integrations/prebid/ ` to follow the integration routing pattern.
315330
3163313 . ** HTML rewrites through the registry** – When ` auto_configure ` is enabled, the integration’s
317332 ` IntegrationAttributeRewriter ` removes any ` <script src="prebid*.js"> ` or ` <link href=…> `
0 commit comments