Open ajaishankar opened 4 weeks ago
How would you want to use these injections btw? Can you give me an example?
Sure, this is say for home page personalization where the page is cached at the edge.
But based on a user cookie we can respond with a personalized homepage.
const useHomePagePersonalizationInjection = () => `
var cookies = event.request.cookies;
if(cookies.user && event.request.uri === "/") {
request.querystring = "personalize=true";
}
`
export default $config({
async run() {
new sst.aws.Remix("Web", {
cloudFrontFunctions: {
serverCfFunction: {
injections: [ useHomePagePersonalizationInjection() ]
}
}
})
},
});
Hi
I wanted to add a CloudFront function for Remix, and looks like it's very difficult (the following issue from astro)
https://github.com/sst/ion/issues/663#issuecomment-2247069996
For Remix looks like there is code that internally accepts an array of string
injections
https://github.com/sst/ion/blob/dev/platform/src/components/aws/remix.ts#L545
Would it make sense to expose this in RemixArgs?
Then it would be very simple to add custom logic into both the serverCfFunction and staticCfFunction?
Something like
Thanks!