Open jaulz opened 1 year ago
Interesting, it seems like a bug.
The issue is not clear enough, but what I interpret is that server-side-website
used with REST API and a custom domain:
That is a bug. mydomain.com should work, the stage prefix should be invisible with a custom domain.
As far as I could see we simply need to pass the name of the stage to the default origin (e.g. originPath: '/production',):
That sounds indeed like a good solution, it's something we missed when implementing it originally. I think we would merge a PR that fixes that.
Note: HTTP APIs (v1) shouldn't be impacted.
Start from the Use-case
Unfortunately, I still need to use the REST protocol of the API Gateway (because v2 is not available in Switzerland) but that means that there is an ugly stage prefix in the URL (even with a custom domain). It would be nice if we could pass the origin path to the default origin of the CloudFront distribution so we can hide the stage prefix from end users.
Example Config
Implementation Idea
As far as I could see we simply need to pass the name of the stage to the default origin (e.g.
originPath: '/production',
): https://github.com/getlift/lift/blob/fc3cfc364f2ee7c701a5e7c77da72e2b62f505b4/src/constructs/aws/ServerSideWebsite.ts#L135-L138