Skip to content

Conversation

@arunans23
Copy link
Contributor

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following
format: Resolves issue1, issue2, etc.

Currently, CORS cannot be configured in the REST API which is useful when invoking the APIs direclty from modern browsers.

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI.
Include a link to a Markdown file or Google doc if the feature
write-up is too long to paste here.

This PR brings an improvement to read CORs configuration from synapse.properties file and set in the API request and response path.

The cors can be configured using the following properties in synapse.properties.

synapse.rest.CORSConfig.enabled=true
synapse.rest.CORSConfig.Access-Control-Allow-Origin=http://localhost:3000,https://example.com
synapse.rest.CORSConfig.Access-Control-Allow-Headers=Content-Type,Authorization,X-Requested-With

Release note

If applicable a brief description of the new feature or bug fix as it will appear in the release notes

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Related PRs

List any other related PRs

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

The cors can be configured using the following properties in synapse.properties.

```
synapse.rest.CORSConfig.enabled=true
synapse.rest.CORSConfig.Access-Control-Allow-Origin=http://localhost:3000,https://example.com
synapse.rest.CORSConfig.Access-Control-Allow-Headers=Content-Type,Authorization,X-Requested-With
```
@isudana
Copy link
Contributor

isudana commented Oct 8, 2025

Hi Arunan, Thank you for the contribution. Can you please provide test cases as well?

@isudana isudana merged commit 82737a9 into apache:master Oct 8, 2025
0 of 20 checks passed
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