1

My Caddyfile is pretty easy and looks like this:

:80
tls off
root /var/www
gzip
fastcgi / /var/run/php5-fpm.sock php

Is it possible to restrict access to /var/www/secret, so http://localhost/secret/secretfile.txt is no longer accessible?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Benni
  • 778
  • 8
  • 22

1 Answers1

3

You can use either basicauth or internal to achieve this. Since you want a secret directory, internal would be my recommendation here.


basicauth

basicauth /secret username password  

Still accessible, but protected with username/password.

internal

internal /secret

Not accessible, throws a 404 Not Found status.