Skip to content

Add headers to OPTIONS/HEAD methods for CORS headers #417

@samichoulo911

Description

@samichoulo911

I am currently having issues with some requests due to CORS. I was able to fix my GET/POST methods with the following headers

response.add_header("Access-Control-Allow-Origin", "*");
response.add_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
response.add_header("Access-Control-Allow-Methods", "PUT, POST, GET, DELETE, OPTIONS");
response.add_header("Content-Type", "text/plain");

My issue is when I try to make PUT requests, since they make preflight OPTIONS request. I believe this issue (#117) catches all the OPTIONS/HEAD requests preventing me from adding my own handlers for my routes. Is there a way to configure global headers for all incoming requests? I was thinking of using midleware but I am not sure it is the way to go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssue can be closed by providing information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions