Can we do hybrid rendering WITHOUT Next.js? #1411
-
Next.js apps deployed using SWA can support SSR, is this possible with other deployments? I'm looking to publish a preact app with SWA but I want to be able to use the managed functions like Next.js does to handle SSR on only pages that require it, with the rest being SSG for fast loads. In the API overview it says this: "Route rules for APIs only support redirect" which seems to mean it can't be used to rewrite? Is there a different workaround I can do? It also says in the docs that you can't rewrite non-relative paths which means I couldn't handle it with an entirely separate function app either. Routing rules also only allow wildcards at the end of a path, meaning if you want to use SSR at I get the impression that the only solution I can realistically use if I want to deploy as an SWA is to handle everything client-side, but there are obviously some situations where SSR would be preferred. Any tips would be very helpful! Side note: Maybe is there a way to use Next.js PURELY for routing to get the benefits of it, but then build all my pages using preact?? Sounds a bit odd but it just might be crazy enough to work... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I've been looking at cloudflare workers which look like I could programmatically reverse proxy specific paths like I'm aiming for. 100,000 requests a day is free and if I needed more it is then $5 a month which I'm happy with paying if it were needed. Current idea is that my domain would point to a worker which then sends requests to the static web app for all my static content, then SSR content would be hosted on a function app where the worker only points to it for the specifically SSR pages. Do you see any problems with this approach? I would prefer to be able to do this all on Azure but I don't see a way for this to be possible currently, so I think a cloudflare worker is the next best option. |
Beta Was this translation helpful? Give feedback.
-
Hi @FinOCE, it is indeed possible to achieve SSR with other frameworks than Next.js, but it is slightly different than the solution you propose. Server-side rendering support is usually provided at the framework level, so if you were using Next.js, Nuxt.js, SvelteKit, then you could achieve server-side rendering. |
Beta Was this translation helpful? Give feedback.
Hi @FinOCE, it is indeed possible to achieve SSR with other frameworks than Next.js, but it is slightly different than the solution you propose. Server-side rendering support is usually provided at the framework level, so if you were using Next.js, Nuxt.js, SvelteKit, then you could achieve server-side rendering.