Files
platform/Caddyfile

53 lines
2.0 KiB
Caddyfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Глобальный блок настроек
{
# Email для получения SSL-сертификатов от Let's Encrypt
acme_email mrixs@mrixs.me
}
# Основной блок для вашего домена
mc.mrixs.me {
# Включаем сжатие для ускорения загрузки
encode zstd gzip
# --- Маршрутизация запросов ---
# 1. API бэкенда (Yggdrasil, Web, Admin)
handle_path /api/* /authserver/* /sessionserver/* {
reverse_proxy backend:8080
}
# 2. WebSocket для измерения пинга
handle_path /ws/ping* {
reverse_proxy ping-helper:8081
}
# 3. Раздача файлов (скины, модпаки)
handle_path /files/* {
# Указываем корень, где лежат папки textures и modpacks
root * /srv
# Включаем файловый сервер
file_server
}
# 4. Раздача статики фронтенда (Vue.js SPA)
# Этот блок обрабатывает все остальные запросы
handle {
root * /srv/frontend
# Если файл не найден, отдаем index.html (стандартное поведение для SPA)
try_files {path} /index.html
file_server
}
# --- Заголовки безопасности (рекомендация из ТЗ) ---
header {
# Запрещает встраивать сайт в iframe на других доменах
X-Frame-Options "SAMEORIGIN"
# Защита от MIME-сниффинга
X-Content-Type-Options "nosniff"
# Включает HSTS, заставляя браузеры использовать только HTTPS
Strict-Transport-Security "max-age=31536000;"
# Базовая политика безопасности контента
# Content-Security-Policy "..."
}
}