diff --git a/config/config.go b/config/config.go index e5b43a29..63814984 100644 --- a/config/config.go +++ b/config/config.go @@ -57,6 +57,11 @@ func IsDebug() bool { return os.Getenv("XUI_DEBUG") == "true" } +// IsSkipHSTS returns true if skipping HSTS mode is enabled via the XUI_SKIP_HSTS environment variable. +func IsSkipHSTS() bool { + return os.Getenv("XUI_SKIP_HSTS") == "true" +} + // GetBinFolderPath returns the path to the binary folder, defaulting to "bin" if not set via XUI_BIN_FOLDER. func GetBinFolderPath() string { binFolderPath := os.Getenv("XUI_BIN_FOLDER") diff --git a/web/web.go b/web/web.go index 35516e4d..aa982827 100644 --- a/web/web.go +++ b/web/web.go @@ -132,6 +132,9 @@ func NewServer() *Server { } func (s *Server) isDirectHTTPSConfigured() bool { + if config.IsSkipHSTS() { + return false + } certFile, certErr := s.settingService.GetCertFile() keyFile, keyErr := s.settingService.GetKeyFile() if certErr != nil || keyErr != nil || certFile == "" || keyFile == "" {