Worker to pre-render site?

I am trying to get a worker to fetch content from a website, and send HTML in response. Effectively static site generation or pre rendering the content, would this be possible?
5 Replies
Ricky U
Ricky UOP15mo ago
let me rephrase i dont need SSG i need SSR on a cloudflare worker
tobi
tobi15mo ago
that should be easily doable. most meta frameworks should support it, e.g. SvelteKit with adapter cloudflare or similar frameworks.
Ricky U
Ricky UOP15mo ago
I am using vue without nuxt it is a single page application @tobi This means that when i fetch the website within a worker, it only fetchs the index.html which is a empty div, My guess is that cloudflare does not run the js and wait for the page to load, hence i am stuck in how i can use a worker to render the page on the worker and spit out the html... -- right now it works but the div has no content which is expected since its a spa.
tobi
tobi15mo ago
of course, why would a worker do something that it is not told to do? the worker will only fetch, if that is what the script says.
Ricky U
Ricky UOP15mo ago
right,what i was thinking is using a redirect with a html rewrite.
Want results from more Discord servers?
Add your server