docs: add documentation for experimental browser proxy handler#1742
Open
AlanPonnachan wants to merge 4 commits intopydantic:mainfrom
Open
docs: add documentation for experimental browser proxy handler#1742AlanPonnachan wants to merge 4 commits intopydantic:mainfrom
AlanPonnachan wants to merge 4 commits intopydantic:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
alexmojaki
reviewed
Mar 16, 2026
| !!! info "Securely Sending Traces" | ||
| Logfire does not directly expose an endpoint suitable for sending traces from the browser, as this would make your write token publicly accessible. | ||
|
|
||
| To safely send traces, you must route them through a backend proxy that attaches the `Authorization` header server-side. |
Contributor
There was a problem hiding this comment.
the deleted "forwards requests from your browser instrumentation to Logfire" was good to have for clarity
| Logfire does not directly expose an endpoint suitable for sending traces from the browser, as this would make your write token publicly accessible. | ||
|
|
||
| To safely send traces, you must route them through a backend proxy that attaches the `Authorization` header server-side. | ||
| - **Python:** Use the built-in `logfire_proxy` handler for [FastAPI](../web-frameworks/fastapi.md#proxying-browser-telemetry) or [Starlette](../web-frameworks/starlette.md#proxying-browser-telemetry). |
Contributor
There was a problem hiding this comment.
the forward_export_request function is worth mentioning for generic usage.
| It can also be useful for grouping together child logs and spans produced by the request. | ||
|
|
||
|
|
||
| ## Proxying Browser Telemetry |
Contributor
There was a problem hiding this comment.
i don't think this belongs on this page, same for starlette. it's not about how to instrument fastapi. i think the browser page should get a proper section on the topic with this info, explaining how to do it with fastapi, starlette, or anything else. the fastapi and starlette pages can briefly mention and link to that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the documentation for the newly merged experimental browser proxy handler (
logfire.experimental.forwarding.logfire_proxy) introduced in #1697.It bridges the gap between frontend browser telemetry and Python backends by explaining how to securely route OTLP payloads to Logfire without exposing the Write Token in the client-side code.
Changes Made
docs/integrations/javascript/browser.md:url.pathname = "/logfire-proxy/v1/traces".docs/integrations/web-frameworks/fastapi.md:@app.postwhile injecting theRequestobject.Depends(addressing security considerations discussed in the previous PR).docs/integrations/web-frameworks/starlette.md:Route.