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

Add enableCORS option to IServerOptions to enable/disable CORS #34

Open
paganellif opened this issue May 16, 2024 · 2 comments · May be fixed by #35
Open

Add enableCORS option to IServerOptions to enable/disable CORS #34

paganellif opened this issue May 16, 2024 · 2 comments · May be fixed by #35

Comments

@paganellif
Copy link

paganellif commented May 16, 2024

I need this feature to deploy the streamer as a service behind an API gateway that already checks and sets CORS headers.

Without this feature, I'm not able to use the server APIs because there is more than one origin in the Access-Control-Allow-Origin and this is not allowed.

@paganellif paganellif changed the title Add server option to enable/disable CORS Add enableCORS option to IServerOptions to enable/disable CORS May 16, 2024
@danielweck
Copy link
Contributor

danielweck commented May 16, 2024

just a thought: in DITA R2D2BC web reader you can disable "credentials" in the http requester / fetch client options. Typically that is what forces the removal of asterisk / catch-all CORS allow origin. But perhaps you in fact need "credentials" so indeed you would need to modify the streamer config.

@paganellif paganellif linked a pull request May 16, 2024 that will close this issue
@paganellif
Copy link
Author

paganellif commented May 16, 2024

I've made and tested these changes to src/http/server.ts and it works:

  • added disableCORS?: boolean to IServerOptions
  • initialized in the Serverconstructor
    this.disableCORS = options && options.disableCORS ? options.disableCORS : false
  • used the options in the setResponseCORS to conditionally set CORS

If you agree with these changes, I already have a pull request that could be merged. If the pull request is approved, when do you plan to release the new version? because I really need this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants