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

@zealsham zealsham commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

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

coveralls commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 27700130528

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.07%) to 85.302%

Details

  • Coverage increased (+0.07%) 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: 14744
Covered Lines: 12577
Line Coverage: 85.3%
Coverage Strength: 370.35 hits per line

💛 - Coveralls

@zealsham zealsham force-pushed the use-tower-cors branch 2 times, most recently from 95d65d9 to 39186a3 Compare June 5, 2026 08:50
/// - `(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`)

@Mshehu5 Mshehu5 Jun 6, 2026

Copy link
Copy Markdown
Contributor

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

This pr addresses part of payjoin#941. it replaces the custom cors
handling with tower-http corslayer
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