mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
Make HSTS policy configurable if https is enabled
This commit is contained in:
parent
f9ae0347c6
commit
1120627cd5
2 changed files with 8 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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 == "" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue