pvarki / pvarki/python-rasenmaeher-api

[Feature Request] Add CORS middleware

Open
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1
Forks
1
Avg merge
4d 13h
Merged PRs (30d)
5

Description

RegEx to match the current deployment

rm_base = "https://replaceme.example.org" # FIXME read url from manifest
deployment_domain_regex = rm_base.replace(".", r"\.").replace("https://", r"https://(.*\.)?")
LOGGER.info("deployment_domain_regex={}".format(deployment_domain_regex))

app = FastAPI(docs_url="/api/docs", openapi_url="/api/openapi.json", version=__version__)
app.add_middleware(
    CORSMiddleware,
    allow_origin_regex=deployment_domain_regex,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the FastAPI application setup and the deployment manifest referenced by the issue. Compare the current CORS configuration with the requested deployment-domain regex and middleware options. Done means the API applies the intended CORS policy for the current deployment and the relevant behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.