Gatsby: AWS S3, Cloudfront and custom filename + extension

Created on 21 Jun 2019  ·  5Comments  ·  Source: gatsbyjs/gatsby

Our Gatsby rendered pages will be stored in S3.

S3 can be configured as “Web Hosting” and would do subdirectory root resolution (so request /product/SAPPHIRE would resolve in /product/SAPPHIRE/index.html.)

But when delivering the site via CloudFront with a restricted S3 bucket this is not possible.

My question: Is it possible, using createPages or any other API, to generate a custom path + filename + extension.

stale? question or discussion

All 5 comments

I'm also interested in this, though my motivation is to avoid the redirect that occurs from /product/SAPPHIRE to /product/SAPPHIRE/index.html for performance. I'd like to generate public/product/SAPPHIRE.html instead of public/product/SAPPHIRE/index.html.

My question: Is it possible, using createPages or any other API, to generate a custom path + filename + extension.

I'd like to generate public/product/SAPPHIRE.html instead of public/product/SAPPHIRE/index.html.

Unfortunately, we don't currently support this. File name and extensions are set to index.html (scoped within a folder for the path) and there isn't any way to customise it.

@sidharthachatterjee I'm trying to do something similar. If index.html is fixed, is there at least a way to keep Gatsby from stripping that off URLs when loaded? For example right now if I load <cloudfront domain>/my-page/index.html then it works, but Gatsby replaces the URL with just <cloudfront domain>/my-page/ after JS loads which will not work if the user refreshes.

Update: I just noticed that Gatsby V1 works as I would expect (no forced modification of the URL). Gatsby V2 seems to have introduced the forced URL modification.

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferMartz picture ferMartz  ·  3Comments

andykais picture andykais  ·  3Comments

kalinchernev picture kalinchernev  ·  3Comments

rossPatton picture rossPatton  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments