I have a Gatsby website creating ~86k pages (and I will need many more, probably 500k in the long term).
As it takes a lot of time to build and deploy (approx. 25minutes) I would like to use DSG or SSR on the vast majority of pages.
However, the gatsby-plugin-netlify generates a pair of redirects for each pages.
That makes the _redirects file too large for netlify to process.
Here is the site ID : 5fbdd0db-d4cd-4163-8ee6-6f12847fa2e9
Here is a build log that shows the issue: Netlify App
And a few excerpts for everybody to read:
In the Building step
9:59:32 AM: info [gatsby-plugin-netlify] Created 63344 SSR/DSG redirects...
In the Post-processing step
10:06:36 AM: Post processing - redirect rules
10:06:41 AM: Redirect rule files are too large. Please reduce the combined size of /_redirects and /netlify.toml
Does anyone have an idea to solve this issue ?
Thanks a lot and have a nice day !
Yeah, this is starting to look more like some platform-limits at this point. It’s definitely not possible to increae the limit for number of redirects as those limits are imposed by MongoDB.
Looks like the number of redirects required for adding the DSG support would have to be reduced or some other way needs to be introduced.
Can you please run a build locally using Netlify CLI? You can use the command
netlify build and attach the geneated
Yes, it generates two redirects per routes, so I proposed this solution:
This would allow to disable the automatically generated redirects and let us write our own using placeholders, spats, etc.
I am too new to upload attachments, so here is a link to the file: SwissTransfer.com - Envoi sécurisé et gratuit de gros fichiers
Thanks for your help !
The only solution I can think of in the meanwhile for you is to delete the generated
_redirects file and create one yourself. You can do this as a Shell script or a Node.js script.
Thanks for your suggestion, I’ll give this a try.