robots.txt, manifest.json, or browserconfig.xml needs to be at the root of the site (index page).
How do we serve these files ?
I also have this question, but specifically for favicon and service-workers. Service workers especially have to be at the root and cannot be hosted from a secondary site so would appreciate whatever guidance/suggestions you might have.
Morning folks, I'll be looking at this next and hopefully add some working examples 馃憤
Hey!
Any news?
Sorry this has taken me long, I'm hoping I can have it working this week. I'm planning on having API Gateway also act as a proxy to S3. Then in the plugin you can map routes to static assets in S3. Will try and get a Proposal in a PR between today or tomorrow!
No worries, your library saved me tons of time already!
Were you hesitating using serverless-s3-local?
Because currently, all the static assets (img, favicon...) don't work when using serverless-offline and in production? The files in the static directory don't move into the S3 Bucket for the moment correct?
I might end up using serverless-s3-local for local development when using this plugin, however, that's another piece of work.
You're correct, files under the static/ directory don't get uploaded to S3.
However, this issue goes beyond uploading static/ to S3. Is also about being able to route static assets like robots.txt, service workers etc. at the root of the application:
E.g.:
https://1234.execute-api.us-east-1.amazonaws.com/dev/robots.txt
https://1234.execute-api.us-east-1.amazonaws.com/dev/browserconfig.xml
etc.
Currently the API GW only routes to the serverless pages.
I will provide more detail later but I'm hoping you can specify something like:
# serverless.yml
custom:
serverless-nextjs:
nextConfigDir: ./
routes:
-
src: static/robots.txt
dest: /robots.txt
-
src: static/browserconfig.xml
dest: /browserconfig.xml
I'm still thinking about the details so this might change. I basically want to provide a routes configuration object in the plugin that supports both static files and pages 馃帀
That would be amazing!
Thank you @danielcondemarin 馃檶馃檶馃檶
FYI - Opened the official feature proposal to this here: https://github.com/danielcondemarin/serverless-nextjs-plugin/issues/51.
Closing as this has been released in https://github.com/danielcondemarin/serverless-nextjs-plugin/releases/tag/v1.8.0 馃帀 . See https://github.com/danielcondemarin/serverless-nextjs-plugin/#hosting-static-assets for details.
Most helpful comment
Morning folks, I'll be looking at this next and hopefully add some working examples 馃憤