Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passthrough proxying on xrpc-server #1730

Closed
wants to merge 15 commits into from
Closed

Passthrough proxying on xrpc-server #1730

wants to merge 15 commits into from

Conversation

devinivy
Copy link
Collaborator

@devinivy devinivy commented Oct 10, 2023

This implements http passthroughs on xrpc-server and a proxy handler for forwarding the active request to another service. It's also now used on the relevant proxied app.bsky routes on the PDS to the appview. Some notes:

  • Can return { passthru: http.IncomingRequest } from xrpc-server handlers, and the request will be faithfully passed through.
    • Updated server codegen to reflect this.
  • Implemented xrpcServer.proxy() which proxies the active request using a passthrough.
  • Fixes a header normalization issue in the xrpc client. One "soft" breaking change is that defaultFetchHandler() is no longer responsible for header normalization, and assumes the headers passed to it have already been normalized to lower-case.
  • Where possible PDS routes for app.bsky are now proxied using xrpcServer.proxy(). The exceptions are generally read-after-write endpoints.
    • These routes will now start passing through response headers from appview.

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is beautiful 😍 🙇‍♂️

@devinivy
Copy link
Collaborator Author

Closing this but keeping the branch around—will probably redo this in the future and hit all proxying services.

@devinivy devinivy closed this Dec 29, 2023
@dholms dholms reopened this Jan 18, 2024
@dholms dholms closed this Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants