Some checks are pending
Security Checks / security (push) Waiting to run
统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
17 lines
391 B
Go
17 lines
391 B
Go
package controllers
|
|
|
|
import (
|
|
"git.pcux.cn/xuans/Smail/config"
|
|
"net/http"
|
|
)
|
|
|
|
func Interceptor(w http.ResponseWriter, r *http.Request) {
|
|
cfg := config.CurrentConfig()
|
|
if cfg == nil || cfg.WebDomain == "" {
|
|
http.Error(w, "HTTPS is required", http.StatusUpgradeRequired)
|
|
return
|
|
}
|
|
URL := "https://" + cfg.WebDomain + r.URL.Path
|
|
http.Redirect(w, r, URL, http.StatusMovedPermanently)
|
|
}
|