Skip to content

Conversation

@jasonbahl
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This exposes a new X-GraphQL-Endpoint header to be returned in HTTP requests for WPGraphQL.

Does this close any currently open issues?

closes #2564

Any relevant logs, error output, GraphiQL screenshots, etc?

CleanShot 2022-10-06 at 10 55 39

…lows for caching clients to identify the endpoint caches should be related to. see: varnish/varnish-modules#41 (comment)

- Since the WPGraphQL endpoint can be queried at multiple domains, the caching client can't reliably use the http.host for this. As queries can be queried from host1 and data can be written from host2. ie publicapi.domain.com and content.wphost.com.
@jasonbahl jasonbahl self-assigned this Oct 6, 2022
@coveralls
Copy link

coveralls commented Oct 6, 2022

Coverage Status

Coverage increased (+0.01%) to 82.12% when pulling 6201bb0 on jasonbahl:feat/expose-graphql-endpoint-in-headers into af64d74 on wp-graphql:develop.

- use `Router::$route` instead of `get_graphql_setting()` to determine the endpoint and ensure consistency with existing filters
- Change header name to X-GraphQL-URL instead of endpoint
- update tests
- instantiate Router::$route with graphql_get_endpoint()
- use get_graphql_endpoint() to determine if rewrite rules should be flushed
- update settings to use get_graphql_endpoint instead of Router::$route
- update tests
@jasonbahl jasonbahl changed the title feat: add X-GraphQL-Endpoint to headers of GraphQL Responses feat: add X-GraphQL-URL to headers of GraphQL Responses Oct 6, 2022
… a non falsy value to match previous behavior
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 6201bb0 and detected 0 issues on this pull request.

View more on Code Climate.

@jasonbahl jasonbahl merged commit e9fd3c7 into wp-graphql:develop Oct 6, 2022
@jasonbahl jasonbahl mentioned this pull request Oct 6, 2022
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.

Expose GraphQL Endpoint in headers

3 participants