This is likely not a SST issue, more a AWS issue. ...
# help
d
This is likely not a SST issue, more a AWS issue. I am still truly stumped on the above issue. I have a site
<http://dev.comicshelper.com|dev.comicshelper.com>
where if you request that URL, it goes ahead and grabs the index.html file and returns it successfully. This site happens to be written in Gatsby but that seems not relevant. Because it’s in Gatsby if you navigate around, links are hydrated and the site works as you’d expect. If however, you navigate directly to
<http://dev.comicshelper.com/blog|dev.comicshelper.com/blog>
you get a 403. Document not found. If I go into the bucket, and view it I see it
Copy code
index.html
january-2022/
If I try to navigate directly to the object in the bucket via the console… I get an Access denied. Do I have something messed up in my cloudfront configuration somewhere. What are some explanations for this document not being delivered?
I see. I think I do have something wrong with how this cloudfront setup is configured. https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/deploying-to-s3-cloudfront/
j
Not sure if this is useful for your scenario as I i'm not familar with your front end stack, but this worked for our react app - In your cloudfront distribution config try creating an error response for http 403 code that redirects to /index.html, your app should then handle the routing
d
@James This is exactly what I’m looking at now. I haven’t figured out how to have StaticSite do this on it’s own just yet… But this looks like the solution
j
should be possible in the cfDistribution props:
Copy code
new StaticSite(this, "Site", {
      path: "path/to/src",
      cfDistribution: {
        errorResponses: [
          {
            httpStatus: 403,
            responseHttpStatus: 200,
            responsePagePath: "/index.html",
          },
        ],
      },
    });
d
This only sort of works. In this case I have
Copy code
index.html
/blog
 -- index.html
If I use this setup, cf will resolve
/blog
to
/
which isn’t what I’m looking for. It was a worthwhile attempt and close to the isssue I think