I’m working on a block that recursively forbids access to dotfiles. The approach I thought I’d take is with a named matcher that uses path_regexp, but it’s not working the way I would have expected. Maybe I’m not clear on what path the regexp gets.
@dotfiles {
path_regexp ^\/?(?:\w+\/)*(\.\w+)
}
respond @dotfiles 403
It works for requests to /.dotfile
, but not for /long/path/.dotfile
.
Maybe it’s just my poor regex, but maybe there’s something else for me to learn here. Help is appreciated.
I copied the regex from a stack overflow and tested it in a regex program that was using go’s regex.