Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 83318b0

Browse files
authored
Merge pull request #8567 from nuzil/patch-1
Add information about GraphQL Fasly cache
2 parents 932f3b8 + 19e3ee3 commit 83318b0

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/guides/v2.3/graphql/caching.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@ To enable GraphQL caching on Fastly:
109109

110110
[Set up Fastly]({{ site.baseurl }}/cloud/cdn/configure-fastly.html) describes how to perform both of these tasks.
111111

112+
By default, the Fastly module for Magento provides the following VCL configuration for GraphQL caching:
113+
114+
```text
115+
if (req.request == "GET" && req.url.path ~ "/graphql" && req.url.qs ~ "query=") {
116+
....
117+
```
118+
119+
Fastly will only cache GET requests that contain a query parameter in the request URL.
120+
121+
### Example
122+
123+
```text
124+
http://example.com/graphql?query={ products(filter: {sku: {eq: "Test"}}) { items { name } } }&variables={}
125+
....
126+
```
127+
128+
{:.bs-callout-info}
129+
If you call GraphQL queries in the query body rather than the URL (for example, as `--data-raw '{"query" .... }'`), the request is not cached.
130+
112131
## X-Magento-Vary
113132

114133
The `X-Magento-Vary` cache cookie is not supported for GraphQL. The `Store` and `Content-Currency` headers, along with the content language (which is deduced) determine the context.

src/guides/v2.4/graphql/caching.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@ To enable GraphQL caching on Fastly:
109109

110110
[Set up Fastly]({{ site.baseurl }}/cloud/cdn/configure-fastly.html) describes how to perform both of these tasks.
111111

112+
By default, the Fastly module for Magento provides the following VCL configuration for GraphQL caching:
113+
114+
```text
115+
if (req.request == "GET" && req.url.path ~ "/graphql" && req.url.qs ~ "query=") {
116+
....
117+
```
118+
119+
Fastly will only cache GET requests that contain a query parameter in the request URL.
120+
121+
### Example
122+
123+
```text
124+
http://example.com/graphql?query={ products(filter: {sku: {eq: "Test"}}) { items { name } } }&variables={}
125+
....
126+
```
127+
128+
{:.bs-callout-info}
129+
If you call GraphQL queries in the query body rather than the url (for example, as `--data-raw '{"query" .... }'`), the request is not cached.
130+
112131
## X-Magento-Vary
113132

114133
The `X-Magento-Vary` cache cookie is not supported for GraphQL. The `Store` and `Content-Currency` headers, along with the content language (which is deduced) determine the context.

0 commit comments

Comments
 (0)