So, I know how I can serve for example a plain htm...
# help
a
So, I know how I can serve for example a plain html site using StaticSite construct, and then serve like a React SPA with the ReactStaticSite construct on the same domain by for example using a subdomain for the SPA, but is there a way to mix routes on the same domain? Like have mydomain.com be plain html, then mydomain.com/users an SPA and mydomain.com/blog plain html again?
Maybe customize the cloudfront distribution with lots of additionalBehaviour? Or use the errorPath of one Site construct to redirect into the other?
Maybe I should just switch over to Next.js
Ah damn, the NextjsSite uses lambda@edge, it seems
f
Hey @Adrian Schweizer, here’s a recent thread that might be relevant https://serverless-stack.slack.com/archives/C01JG3B20RY/p1652455985252819
a
Thanks @Frank. Although I want to do the same thing, I'm coming from a different path. I already have an app written as React SPA, and now I have to implement some SEO-friendly parts, and am trying to find the easiest way to do that with SST. So far I've thought about the following: • Just move the SPA to a subdomain like app.mydomain.com and implement the SEO friendly stuff with any SSG framework and seperate Site construct on main domain • Use React with StaticRouter, Server Side Rendering and Lambda@Edge and some Cloudfront magic • Move the app over to Next.js (similar to above, but probably working out of the box) • Basically like the first point, but try to hack the Cloudfront distribution to similar to second point to serve either SSG content or SPA, so that we could keep the app URL the same as it is now One thing that makes it harder is that Lambda@Edge should be avoided if possible (not my choice, is an external requirement). I don't think I'll find a quick and easy solution, but I'll let you know if I can get something to work.
In the meantime, I have also discovered Svelte and the ViteStaticSite construct and am actually quite smitten by it right now, so I might just rewrite everything anyway, but we'll see.