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

Webserver-level CORS header manipulation #249

Open
mhsdef opened this issue Apr 27, 2024 · 2 comments
Open

Webserver-level CORS header manipulation #249

mhsdef opened this issue Apr 27, 2024 · 2 comments
Labels
Enhancement New feature or request

Comments

@mhsdef
Copy link

mhsdef commented Apr 27, 2024

We need some way to set CORS headers at wp-now's Express server level similar to what can be done with .htaccess in Apache setups:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "_origin here_"
</IfModule>

We do have a mu-plugin that spins in the PHP handling and that's a solution for most folk since the typical situation is API backend; but, a plugin approach doesn't cover things like, say, a cross-origin static resource @font-face load (in Firefox) to a WP backend which matters for the way we're using WP in our case.

Our use case is fairly unique, but, WP deployments can get "unique" in the real world, so I do think Express header manipulation makes general sense for a certain segment of users.

Maybe something like..?

wp-now --headers <whatever ux makes sense>
@mhsdef
Copy link
Author

mhsdef commented Apr 27, 2024

Or, riffing further, a way to do it via the config feels even better.

{
      "step": "setWebserverHeader",
      "header": "Access-Control-Allow-Origin http://localhost:3000"
}

@adamziel
Copy link
Collaborator

cc @sejas

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

No branches or pull requests

2 participants