Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Static website] - load SPA via another path (not root) failed (error 403) #164

Closed
piolet opened this issue Feb 4, 2022 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@piolet
Copy link

piolet commented Feb 4, 2022

Description

Hi all,

I deployed an SPA application (vue JS) via the construct Static Website. It works correctly except one detail.

If i share the url for my SPA to another user, for example : https://app.example.com, it's ok.
But, if i share antoher url, not the root, for example : https://app.example.com/parameters
i have an access denied error :
Capture d’écran 2022-02-04 à 12 29 23

How to Reproduce

to reproduce, the default construct like this :

constructs:
    app:
        type: static-website
        path: _dist
        domain:
            - app.${self:custom.domain}
            - demo.${self:custom.domain}
        # ARN of an ACM certificate for the domain, registered in us-east-1
        certificate: ${cf(us-east-1):certificate-${opt:stage, 'dev'}.StarCertificate}
        redirectToMainDomain: false

Additional Information

this error could be avoid with 3 adjustments in the construct

  1. update S3 assets bucket to allow host site
  2. update cloudfront origin. Not S3 origin, but CustomOrigin (HttpOrigin) to S3 static's url
  3. manage 403 error like 404 error

With this 3 updates, we could load directly another url (not root url)

@piolet piolet added the bug Something isn't working label Feb 4, 2022
@t-richard
Copy link
Contributor

I think it's a duplicate of #163

The issue is related to a recent update in the CDK that changed some permissions

@piolet
Copy link
Author

piolet commented Feb 4, 2022

Ah, maybe.

I don’t know the CDK background ;)

@moein-tropee
Copy link

@piolet it's indeed exactly the same issue.

@piolet
Copy link
Author

piolet commented Feb 4, 2022

@moein-tropee same issue 2 options to fix it ;)

adriencaccia added a commit to adriencaccia/lift that referenced this issue Feb 6, 2022
Switch the origin bucket configuration to static website hosting,
leaving the configuration on the bucket side, without having to rely
on a custom origin access identity.

Fix getlift#163, getlift#164
@mnapoli mnapoli closed this as completed Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants