Skip to content

Commit

Permalink
Use a block in caddyfile
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Oct 12, 2024
1 parent 16a7536 commit da0ccbf
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 50 deletions.
99 changes: 50 additions & 49 deletions caddy/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,59 @@
# NOTE: See @filter for the further details
order respond before rewrite
}
femiwiki.com *.femiwiki.com 127.0.0.1:80 localhost:80
tls {
dns route53
}
root * /srv/femiwiki.com
php_fastcgi {$FASTCGI_ADDR}
file_server
encode gzip
mwcache {
ristretto {
num_counters 30000
max_cost 10000
buffer_items 64
femiwiki.com *.femiwiki.com 127.0.0.1:80 localhost:80 {
tls {
dns route53
}
purge_acl {
10.0.0.0/8
127.0.0.1
root * /srv/femiwiki.com
php_fastcgi {$FASTCGI_ADDR}
file_server
encode gzip
mwcache {
ristretto {
num_counters 30000
max_cost 10000
buffer_items 64
}
purge_acl {
10.0.0.0/8
127.0.0.1
}
}
header {
# HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Enable XSS filtering for legacy browsers
X-XSS-Protection "1; mode=block"
# Block content sniffing, and enable Cross-Origin Read Blocking
X-Content-Type-Options "nosniff"
# Avoid clickjacking
X-Frame-Options "DENY"
}
}
header {
# HSTS
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Enable XSS filtering for legacy browsers
X-XSS-Protection "1; mode=block"
# Block content sniffing, and enable Cross-Origin Read Blocking
X-Content-Type-Options "nosniff"
# Avoid clickjacking
X-Frame-Options "DENY"
}

rewrite /w/api.php /api.php
rewrite /w/* /index.php
rewrite /w/api.php /api.php
rewrite /w/* /index.php

# Ignore malformed requests
@filter0 {
path /w/특수:내언어/페미위키:대문
vars_regexp {query} ^=[0-9]{1,5}$
}
@filter1 {
path /
vars_regexp {query} ^[A-Z]{5}=[A-Z]{3}$
}
@filter2 {
header User-Agent *ClaudeBot*
}
# Ignore malformed requests
@filter0 {
path /w/특수:내언어/페미위키:대문
vars_regexp {query} ^=[0-9]{1,5}$
}
@filter1 {
path /
vars_regexp {query} ^[A-Z]{5}=[A-Z]{3}$
}
@filter2 {
header User-Agent *ClaudeBot*
}

respond @filter0 200 {
close
}
respond @filter1 200 {
close
}
respond @filter2 200 {
close
respond @filter0 200 {
close
}
respond @filter1 200 {
close
}
respond @filter2 200 {
close
}
}
2 changes: 1 addition & 1 deletion jobs/http.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ job "http" {
source = "https://github.com/femiwiki/nomad/raw/main/caddy/Caddyfile"
destination = "local/Caddyfile.tpl"
mode = "file"
options { checksum = "md5:ee0300e384afa6aca74f09a44323ee6e" }
options { checksum = "md5:2a1ec2a963336735ef480843e54fb205" }
}
template {
source = "local/Caddyfile.tpl"
Expand Down

0 comments on commit da0ccbf

Please sign in to comment.