funkhaus / wp-graphql-cors

Makes WP GraphQL's authetication "just work". It does this by customizing the CORS headers.
GNU General Public License v3.0
112 stars 21 forks source link

Adding Access Control Allow Header custom field & logic to implement … #17

Closed tsvecak closed 4 years ago

tsvecak commented 4 years ago

This will allow a user to add it's own custom fields into headers and that way prevent any cors issues with custom fields being sent along the request

image

EDIT: Reason behind this PR was that we have an apollo client that sends a custom parameter in headers when it reaches out to multiple services. In order to reduce amount of complexity on the client side we've thought it might benefit others to be able to add custom fields to headers within their projects.

Please do point out if any of the updates don't make sense or require some more info etc.

drewbaker commented 4 years ago

This is super interesting and I can see why you'd need that. Does your client only need these headers set on the graphql endpoint? I just wonder if that sort of thing is better off being set in the theme than here?

tsvecak commented 4 years ago

Fair point Drew... Tbh in the case I have we will only ever use it for graphql so in our case it makes no sense to apply this to REST endpoints.

drewbaker commented 4 years ago

I can see why you'd want to control this here, makes sense.