-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Due to the fact my SPA application has hydration issues on ios (separate bug) I am currently in a position where I cannot use SSR, so I have to use an SPA and pre-rendered pages for SEO.
My application currently sits on azure static sites and I am very happy with the performance and devops integrations.
So i am looking at integrating a service where search engine bots are re-directed to a static copy of my site, this would be easy in IIS or Nginx, but ideally I would like to stay on static-web-app.
The service page-replica publishes these instructions:
- Detect bot traffic using the User-Agent header (e.g., Googlebot, Bingbot, Facebook, Twitter, etc.).
- Redirect bots to the prerendered cache URL (e.g.,
https://cache.page-replica.com/[siteId]/[domain]/[path]). - Serve normal users your regular dynamic site as usual.
I think I can do this via staticwebapp.config.json, but I am unsure.
Will the below wildcard routing and re-direct work?
{
"routes" : [
{
"route": "/*",
"redirect": "https://cache.page-replica.com/200/www.example.com/*",
"headers": {
"User-Agent": "Googlebot"
}
},
{
"route": "/*",
"redirect": "https://cache.page-replica.com/200/www.example.com/*",
"headers": {
"User-Agent": "bingbot"
}
}
],
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/images/*.{png,jpg,gif}", "/css/*"]
}
}
Metadata
Metadata
Assignees
Labels
No labels