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

fix: ensure RegExp[] origin can be passed to appSecurityOptions #498

Merged

Conversation

Shana-AE
Copy link
Contributor

fix #497

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

useRuntimeConfig() get runtimeConfig from process.env, which JSON.stringifyed the runtimeConfig, and also JSON.stringify(RegExp) is '{}', so when corsHandler.origin is RegExp[], it doesn't work.
I add custom toJSON method to RegExp members inside corsHandler.origin, and parse it back to RegExp when assign runtimeConfig to appSecurityOptions.

I'm not sure if there is a better solution. Tell me if it exists.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

Copy link

vercel bot commented Jul 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuxt-security ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2024 3:32am

@Baroshem Baroshem changed the base branch from main to chore/2.0.0 July 26, 2024 07:53
@Baroshem
Copy link
Collaborator

Hey there, thanks for this PR!

I have moved the base branch from main to 2.0.0 as we would like to release a new version soon :)

@Baroshem Baroshem merged commit 765d7e1 into nuxt-modules:chore/2.0.0 Jul 26, 2024
3 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.

when corsHandler.origin is RegExp[], it doesn't work
2 participants