Astro | WP Engine Headless Platform Test Site

Middleware

This page shows a randomly generated UUID. The UUID is generated using middleware. It should change every request. If you refresh quickly you'll see the same UUID. Give it 10 seconds and the UUID will change.


UUID:

fd5cc9b4-727f-422a-aa14-dcfe76c6b6cb

✅ Good:

  • The page is rendered with the UUID and this appears to work locally!

⚠️ Warning:

  • The WP Engine Headless platform cache sits in front of the server. Astro Middleware is run on the server. This means middleware is not executed if page is served from the cache! If you need middleware to work correctly, you must be careful how Cache-Control headers are set to cache responses.

  • IF you're using middleware on Static Page routes, you must set the Cache-Control header to no-store or no-cache to ensure the middleware is executed on every request.

  • IF you're using middleware on SSR routes, you must set the Cache-Control header to no-store or no-cache to ensure the middleware is executed on every request.