I have setup the above site so the link test netlify | test netlify should only be seen by a logged in user. I have enabled netlify identity of course and created some users/roles.
The website is built with vitepress and I tested both a netlify.toml file in the root of the repository with the following redirect syntax:
[[redirects]]
from = "/doc/*"
to = "/doc/:splat"
force = true
status = 200
conditions = {Role = ["user", "admin"]}
and then I tested by using a _redirects file with the following syntax:
/doc/* /doc/:splat 200! Role=user,admin
In both cases, regardless I am logged out or logged in I can visit test netlify | test netlify and I can see the text that I am not supposed to see if I am logged out PLUS a 404 that is injected in the main content.
Are redirects actually working in the starter tier? am I doing something wrong?
Hi @SamO, I did read that documentation prior to posting. Anyway, I solved it by adding a second redirect (301) for the same path for non authorized users that redirects to a login page, the following code in netlify.toml works:
[[redirects]]
from = "/doc/*"
to = "/doc/:splat"
force = true
status = 200
conditions = {Role = ["user", "admin"]}
[[redirects]]
from = "/doc/*"
to = "/login/login"
force = true
status = 301