add cors middleware - #549
Draft
slashburygin wants to merge 3 commits into
Draft
Conversation
Contributor
Reviewer's GuideIntroduce a configurable CORS middleware for the user API WSGI application, wired through oslo.config options and applied to both preflight OPTIONS requests and normal responses based on allowed origins. Sequence diagram for CORS middleware request handlingsequenceDiagram
actor Client
participant CORSMiddleware
participant OpenApiApplication
Client->>CORSMiddleware: HTTP request
activate CORSMiddleware
CORSMiddleware->>CORSMiddleware: __call__(req)
alt [req.method == OPTIONS and _is_origin_allowed(origin)]
CORSMiddleware-->>Client: req.ResponseClass(status=200, headers=_cors_headers(origin))
else [non-OPTIONS or origin not allowed]
CORSMiddleware->>OpenApiApplication: req.get_response(application)
activate OpenApiApplication
OpenApiApplication-->>CORSMiddleware: response
deactivate OpenApiApplication
alt [_is_origin_allowed(origin)]
CORSMiddleware->>CORSMiddleware: _cors_headers(origin)
CORSMiddleware->>Client: response with CORS headers
else [origin not allowed]
CORSMiddleware-->>Client: response without CORS headers
end
end
deactivate CORSMiddleware
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Bumps the core-packages group with 1 update in the / directory: [restalchemy](https://github.com/infraguys/restalchemy). Updates `restalchemy` from 15.2.2 to 15.2.8 - [Release notes](https://github.com/infraguys/restalchemy/releases) - [Commits](infraguys/restalchemy@15.2.2...15.2.8) --- updated-dependencies: - dependency-name: restalchemy dependency-version: 15.2.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: core-packages ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 by Sourcery
Introduce configurable CORS support to the user API by adding a dedicated middleware and wiring it into the WSGI application and CLI configuration.
New Features:
Enhancements: