Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aefafea

Browse files
committed
Hide .git folders from website
This is generally considered a security issue, but it's kind of meaningless for us since we are serving public repos that contain no secrets, nor are running any webapps that could accidentally expose anything from it. But we can hide to satisfy security scanners.
1 parent 796b46e commit aefafea

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

templates/Caddyfile.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
handle_path /{args.0}/* {
99
root * {{ caddy.site_dir }}/{args.0}
1010
try_files {path}.html {path}
11-
file_server
11+
file_server {
12+
hide .git
13+
}
1214
}
1315
}
1416

@@ -77,14 +79,18 @@ http://{{ caddy.addresses.main }}, http://{{ ansible_fqdn }} {
7779
handle {
7880
root * {{ caddy.site_dir }}/matplotlib.github.com
7981
try_files {path}.html {path}
80-
file_server
82+
file_server {
83+
hide .git
84+
}
8185
}
8286

8387
# Use a custom 404 error page.
8488
handle_errors {
8589
@notfound expression {http.error.status_code} == 404
8690
root * {{ caddy.site_dir }}/mpl-brochure-site
8791
rewrite @notfound /404.html
88-
file_server
92+
file_server {
93+
hide .git
94+
}
8995
}
9096
}

0 commit comments

Comments
 (0)