Skip to content

Use tower-http corslayer for handling cors#1604

Open
zealsham wants to merge 1 commit into
payjoin:masterfrom
zealsham:use-tower-cors
Open

Use tower-http corslayer for handling cors#1604
zealsham wants to merge 1 commit into
payjoin:masterfrom
zealsham:use-tower-cors

Conversation

@zealsham
Copy link
Copy Markdown
Collaborator

@zealsham zealsham commented Jun 4, 2026

This pr addresses part of #941. it replaces the custom cors handling with tower-http corslayer

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Jun 4, 2026

Coverage Report for CI Build 27005289820

Coverage increased (+0.08%) to 85.436%

Details

  • Coverage increased (+0.08%) from the base build.
  • Patch coverage: 8 of 8 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13849
Covered Lines: 11832
Line Coverage: 85.44%
Coverage Strength: 392.41 hits per line

💛 - Coveralls

This pr addresses part of payjoin#941. it replaces the custom cors
handling with tower-http corslayer
/// - `(POST, "/")` => relay to default gateway (needed for backwards-compatibility only)
/// - `(POST, /http(s)://...)` => RFC 9540 opt-in gateway specified in path
/// - `(GET, /http(s)://...)` => OHTTP bootstrap via WebSocket with opt-in gateway
/// - `(OPTIONS, _)` => CORS preflight handling (handled by `tower_http::cors::CorsLayer`)
Copy link
Copy Markdown
Contributor

@Mshehu5 Mshehu5 Jun 6, 2026

Choose a reason for hiding this comment

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

utACK
nit: Could we add a comment a like this next to the CorsLayer setup since OPTIONS is handled by CorsLayer not is_relay_re quest could be more would help

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A little confuse on what you mean due to wordings. However cors isnt just for options request, it handles both origin in request and access-control* in response

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.

3 participants