90 lines
2.7 KiB
YAML
90 lines
2.7 KiB
YAML
# Cấu hình bảo mật cho ứng dụng
|
|
|
|
# Cấu hình CORS
|
|
cors:
|
|
# Danh sách các domain được phép truy cập (sử dụng "*" để cho phép tất cả)
|
|
allowed_origins:
|
|
- "https://example.com"
|
|
- "https://api.example.com"
|
|
|
|
# Các phương thức HTTP được phép
|
|
allowed_methods:
|
|
- GET
|
|
- POST
|
|
- PUT
|
|
- PATCH
|
|
- DELETE
|
|
- OPTIONS
|
|
|
|
# Các header được phép
|
|
allowed_headers:
|
|
- Origin
|
|
- Content-Type
|
|
- Content-Length
|
|
- Accept-Encoding
|
|
- X-CSRF-Token
|
|
- Authorization
|
|
- X-Requested-With
|
|
- X-Request-ID
|
|
|
|
# Các header được phép hiển thị
|
|
exposed_headers:
|
|
- Content-Length
|
|
- X-Total-Count
|
|
|
|
# Cho phép gửi credentials (cookie, authorization headers)
|
|
allow_credentials: true
|
|
|
|
# Thời gian cache preflight request (ví dụ: 5m, 1h)
|
|
max_age: 5m
|
|
|
|
# Bật chế độ debug
|
|
debug: false
|
|
|
|
# Cấu hình Rate Limiting
|
|
rate_limit:
|
|
# Số request tối đa trong khoảng thời gian
|
|
rate: 100
|
|
|
|
# Khoảng thời gian (ví dụ: 1m, 5m, 1h)
|
|
window: 1m
|
|
|
|
# Danh sách các route được bỏ qua rate limiting
|
|
excluded_routes:
|
|
- "/health"
|
|
- "/metrics"
|
|
|
|
# Cấu hình Security Headers
|
|
headers:
|
|
# Bật/tắt security headers
|
|
enabled: true
|
|
|
|
# Chính sách bảo mật nội dung (Content Security Policy)
|
|
content_security_policy: "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'"
|
|
|
|
# Chính sách bảo mật truy cập tài nguyên (Cross-Origin)
|
|
cross_origin_resource_policy: "same-origin"
|
|
cross_origin_opener_policy: "same-origin"
|
|
cross_origin_embedder_policy: "require-corp"
|
|
|
|
# Chính sách tham chiếu (Referrer-Policy)
|
|
referrer_policy: "no-referrer-when-downgrade"
|
|
|
|
# Chính sách sử dụng các tính năng trình duyệt (Feature-Policy)
|
|
feature_policy: "geolocation 'none'; midi 'none'; notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; vibrate 'none'; fullscreen 'none'; payment 'none'"
|
|
|
|
# Chính sách bảo vệ clickjacking (X-Frame-Options)
|
|
frame_options: "DENY"
|
|
|
|
# Chính sách bảo vệ XSS (X-XSS-Protection)
|
|
xss_protection: "1; mode=block"
|
|
|
|
# Chính sách MIME type sniffing (X-Content-Type-Options)
|
|
content_type_options: "nosniff"
|
|
|
|
# Chính sách Strict-Transport-Security (HSTS)
|
|
strict_transport_security: "max-age=31536000; includeSubDomains; preload"
|
|
|
|
# Chính sách Permissions-Policy (thay thế cho Feature-Policy)
|
|
permissions_policy: "geolocation=(), microphone=(), camera=()"
|