diff --git a/docs/docs/environment-variables.md b/docs/docs/environment-variables.md index c477add7bcbf0..d0b07a6560dc5 100644 --- a/docs/docs/environment-variables.md +++ b/docs/docs/environment-variables.md @@ -134,9 +134,7 @@ Gatsby also allows you to specify another environment variable when running the - `ENABLE_GATSBY_REFRESH_ENDPOINT` -If set to true, this will expose a `/__refresh` webhook that is able to receive `POST` requests to _refresh_ the sourced content. This exposed webhook can be triggered whenever remote data changes, which means you can update your data without re-launching the development server. - -You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`. +This allows you to refresh your sourced content. See [Refreshing content](/docs/content-and-data/refreshing-content). ## Build Variables diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md new file mode 100644 index 0000000000000..0fda055445b34 --- /dev/null +++ b/docs/docs/refreshing-content.md @@ -0,0 +1,13 @@ +--- +title: Refreshing Content +--- + +During local development, it can be useful to refresh sourced content without restarting the development server. To facilitate this, Gatsby exposes an environment variable called `ENABLE_GATSBY_REFRESH_ENDPOINT`. + +If set to `true`, this will expose a `/__refresh` webhook that can receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. + +You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`. + +Additionally, the sourced content can also be refreshed with the "Refresh Data" button in the [GraphiQL explorer](/docs/running-queries-with-graphiql). This button is only visible if `ENABLE_GATSBY_REFRESH_ENDPOINT` is set to `true`. + +Securing the refresh endpoint is possible by supplying a value for the environmental variable `GATSBY_REFRESH_TOKEN`, which will cause Gatsby to only accept requests with a matching authorization header. For example `GATSBY_REFRESH_TOKEN=12345` would require a request with header: `authorization: 12345`. diff --git a/www/src/data/sidebars/doc-links.yaml b/www/src/data/sidebars/doc-links.yaml index 77234f97d9772..51334bdc59c16 100644 --- a/www/src/data/sidebars/doc-links.yaml +++ b/www/src/data/sidebars/doc-links.yaml @@ -228,6 +228,8 @@ - title: Sourcing Content from JSON or YAML link: /docs/sourcing-content-from-json-or-yaml/ breadcrumbTitle: JSON or YAML + - title: Refreshing Content + link: /docs/refreshing-content/ - title: Querying Your Data with GraphQL link: /docs/graphql/ breadcrumbTitle: Querying with GraphQL