ion
ion copied to clipboard
Remix/SsrSite: allow cloudFrontFunctions custom injections for serverCfFunction & staticCfFunction
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
return validatePlan({
edge,
cloudFrontFunctions: {
serverCfFunction: {
injections: [useCloudFrontFunctionHostHeaderInjection()],
},
staticCfFunction: {
injections: [
`request.uri = request.uri.split('/').map(encodeURIComponent).join('/');`,
],
},
},
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
export interface RemixArgs extends SsrSiteArgs {
cloudFrontFunctions: {
serverCfFunction: { injections: string[] },
staticCfFunction: { injections: string[] }
},
...
}
Thanks!