Hey there, is there any way you could setup your A...
# help
k
Hey there, is there any way you could setup your API to run under
<http://yourdomain.com/api|yourdomain.com/api>
and you static site under
<http://yourdomain.com|yourdomain.com>
, I am asking because this way I would prevent cors and preflight (OPTION) calls
m
k
I could try that… what I am concerned is that StaticSite uses CF and points the route 53 record to the CF and since it would be the same record (I am assuming) in route 53 it would not work…
d
I recommend against this, for lots of reasons including local development (which is a key SST differentiator), but you would need to place the StaticSite CloudFront in front of the Api using a custom behavior for the path.
k
Yeah you are right the other thing that is weird is that I enabled caching for the preflight but for some reason the browser is ignoring it 🤷‍♂️
d
Relying on the browser is always gonna be a crapshoot, but you should be able to do something cachelike in your backend.
ApiGateway HTTP does it fairly automatically.
k
Yeah i was hoping to prevent that unnecessary round trip for the options call
d
Sure, worth trying to fix to be sure.
k
Either way not really a big deal was mostly wondering but you are right that can come with other issues
d
And costs (cft now part of your API)
k
Yeah 100%