Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): add --cors argument to enable cors for all workers #202

Merged

Conversation

Narayanbhat166
Copy link
Contributor

@Narayanbhat166 Narayanbhat166 commented Aug 27, 2023

This PR will add the support for configuring origins to enable CORS for all the workers. If the worker has setup Access-Control-Allow-Origin then it will be respected. Multiple origins can be passed using the --cors flag. This is a simple example

wws --cors https://example.com .

This will add https://example.com to all the workers who do not have Access-Control-Allow-Origin header configured. This can be tested out by the below curl command

curl http://127.0.0.1:8080/worker -i
HTTP/1.1 200 OK
content-length: 11
access-control-allow-origin: https://example.com
content-type: text/html
x-generated-by: wasm-workers-server
date: Mon, 28 Aug 2023 16:10:25 GMT

Hello wasm!

To enable all origins, wws can be run with the argument

wws --cors '*' .

Closes #46

@vmwclabot
Copy link

@Narayanbhat166, you must sign our contributor license agreement before your changes are merged. Click here to sign the agreement. If you are a VMware employee, read this for further instruction.

@vmwclabot
Copy link

@Narayanbhat166, we have received your signed contributor license agreement. The review is usually completed within a week, but may take longer under certain circumstances. Another comment will be added to the pull request to notify you when the merge can proceed.

@vmwclabot
Copy link

@Narayanbhat166, VMware has approved your signed contributor license agreement.

@Angelmmiguel Angelmmiguel self-requested a review August 28, 2023 10:13
@Angelmmiguel Angelmmiguel added this to the v1.5.0 milestone Aug 28, 2023
@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Aug 28, 2023
@Angelmmiguel Angelmmiguel self-assigned this Aug 28, 2023
Copy link
Contributor

@Angelmmiguel Angelmmiguel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Narayanbhat166!

Thank you very much for your contribution 🎉 . The code LGTM!

I'm gonna merge it right after tests passes. We will need to rebase this change into #185, as we're consolidating all app_data into a single structure. @ereslibre will consolidate it in that PR.

Thank you! 👏

@Angelmmiguel Angelmmiguel merged commit dbcf752 into vmware-labs:main Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure CORS headers globally
3 participants