Skip to content

Configure CORS headers globally #46

@Angelmmiguel

Description

@Angelmmiguel

Cross-Origin Resource Sharing (CORS) is a series of security policies to avoid a web browser fetching resources from a different domain. By default, CORS will block any request that a website makes to a different domain.

However, servers can set the CORS HTTP headers to indicate the browser they are fine to process the request. CORS can be configured using several headers. Some of them provides a global policy while others helps to add granularity to the requests:

  • Access-Control-Allow-Origin: http://example.com
  • Access-Control-Allow-Methods: POST, GET, OPTIONS
  • Access-Control-Allow-Headers: Content-Type
  • Access-Control-Max-Age: 10000

I recommend you to check the Cross-Origin Resource Sharing (CORS) documentation about the different headers and behaviors.

On wws, we plan to provide two different approaches to set the CORS policy:

  • With a global --cors option. This option will configure the Access-Control-Allow-Origin header. It will be applied to all requests
  • Every worker can set its own headers. In this way, we allow workers to customize the response. This approach has preference to the --cors option. If both are set, the worker value will be sent

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions