Add souin http cache middleware

This commit is contained in:
Gbanyan 2025-04-18 15:30:53 +08:00
parent 8881deb816
commit 3662ab2605
3 changed files with 30 additions and 5 deletions

View File

@ -6,7 +6,7 @@ services:
# ports: # ports:
# - 10.0.0.225:80:80 # - 10.0.0.225:80:80
# - 10.0.0.225:443:443 # - 10.0.0.225:443:443
# - 192.168.50.4:8080:8080 # - 192.168.50.4:9090:9090
# - 192.168.50.4:80:80 # - 192.168.50.4:80:80
# - 192.168.50.4:443:443 # Added port mapping for the dashboard # - 192.168.50.4:443:443 # Added port mapping for the dashboard
restart: unless-stopped restart: unless-stopped
@ -33,9 +33,15 @@ services:
- "com.centurylinklabs.watchtower.enable=true" # Added label for Watchtower - "com.centurylinklabs.watchtower.enable=true" # Added label for Watchtower
# "traefik.http.middlewares.auth.basicauth.usersfile=/dashboard_authfile" # "traefik.http.middlewares.auth.basicauth.usersfile=/dashboard_authfile"
- "traefik.http.services.traefik.loadbalancer.server.port=9090" - "traefik.http.services.traefik.loadbalancer.server.port=9090"
redis:
#networks: image: valkey/valkey:latest
container_name: traefik-redis
restart: unless-stopped
networks:
internal_traefik_default:
ipv4_address: 172.20.0.100
networks:
# traefik_default: # traefik_default:
# external: true # external: true
# internal_traefik_default: internal_traefik_default:
# external: true external: true

View File

@ -30,6 +30,22 @@ http:
- application/javascript - application/javascript
- application/json - application/json
- text/plain - text/plain
http-cache:
plugin:
souin:
default_cache:
ttl: 10s
default_cache_control: public, max-age=600
redis:
url: 172.20.0.100://redis:6379
allowed_http_verbs:
- GET
- HEAD
- POST
log_level: debug
api:
souin: {}
prometheus: {}
routers: routers:
block-direct-access: block-direct-access:
rule: "HostRegexp(`{host:.+}`)" # Matches any host rule: "HostRegexp(`{host:.+}`)" # Matches any host

View File

@ -103,3 +103,6 @@ experimental:
bouncer: bouncer:
moduleName: github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin moduleName: github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin
version: v1.4.2 version: v1.4.2
souin:
moduleName: github.com/darkweak/souin
version: v1.7.6