Deny access to to specific files

This rewrite rule used to work for me in 0.9.0:

rewrite { regexp  ^/?(\.git|\.tx|installer|SQL|bin|config|logs|temp|tests|program\/(include|lib|localization|steps)) status 403 }

However since updating to 0.9.3 it errors

2016/10/24 16:20:55 /etc/Caddyfile:40 - Parse error: Wrong argument count or unexpected line ending after 'rewrite'

What is the correct way to throw a forbidden error on certain files?

The status subdirective is now its own directive to fix a bug. You can use it now in the docs.

Sorry I didn’t have time to write a blog post about these changes, just been a very busy couple of months!

1 Like

Thank you Matt - status looks like it will get me out of trouble.

Appreciate all the hard work!

I am not sure if it supports regular expressions, that might be on the todo list…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.