I am pushing prebuilt static files to netlify and my folder structure is like
|
---- Client
---- ServerAssets
---- FrontAssets
---- ThirdPartAssets
I would like to serve SPA that’s inside Client so my redirect rule is like
[[redirects]]
from = "/*"
to = "client/index.html"
status = 200
On this redirect rule, the assets inside client are trying to get from root like /static/bundle.js, but it’s actually inside client so I can add rule like the following, this solves that problem
[[redirects]]
from = "/static/*"
to = "client/static/:splat"
status = 200
But when I access a service-worker.js that resides under client root will fail. Because the above rule only applicable for assets inside static, So I found another fix.
[[redirects]]
from = "/*"
to = "client/:splat"
status = 200
But I have to replace the above first rule of serving index.html for the app.
Any way to achieve this?
I need to access client/service-worker.js as domain.com/service-worker.js that resides in the root of client and serve client/index.html for domain.com