Join the Webstudio community

Updated 2 months ago

Questions about Graphql data

At a glance

The community member's site currently retrieves content from a WordPress backend using GraphQL. They are interested in understanding how WebStudio caches these queries and for how long. The community member has noticed that the query results remain in the designer until manually refreshed, and they want to know if there is a way to set the lifespan of this information to reduce the load on the backend.

The community member also wants to know whether the calls to the backend are made by the WebStudio server or the browser client, and they are considering restricting the GraphQL endpoint to only allow requests from the WebStudio server's IP address to address some unwanted DDoS attacks.

The comments suggest that caching depends on various factors, including the headers set by the backend and Cloudflare's fetch cache, and provide a link to the WebStudio documentation on caching. However, there is no explicitly marked answer in the comments.

Useful resources
My current site right now fills some elements in the home page (the menu content, some featured posts) from a wordpress backend using graphql. Also every individual page/post will also get its content from there.

How does webstudio "cache" these queries? And for how long? I remember reading something you guys said about increasing the time that info lives. In the designer itself the result of the query pretty much remains until you manually refresh and I wanted to check if there was a way to set the lifespan of that information.
The current site doesn´t change information that often and increasing the life of the information before needing a query to the backend would reduce the load on the backend significantly.

I also would like to know about the call itself to the backend: Is it done by the server that holds the webstudio site itself? or by the browser client? I have been dealing with some unwanted ddos attacks on the site and backend and I am wondering If i can restrict the graphql endpoint to only allow requests from the IP of the webstudio server..

Overall I´m just looking to understand a little better how webstudio retrieves the info from a backend to try to come up with better solutions to keep the site up with less dependency on the backend site.
O
J
2 comments
Generally caching depends on multiple factors: headers your backend sets, cloudflare's fetch cache, which you can read up
Add a reply
Sign up and join the conversation on Discord