mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-11-28 16:46:56 +08:00
* feat(website): add custom HTTPS redirect port option Allow HTTP-to-HTTPS redirects to omit the local HTTPS port for Cloudflare or other reverse-proxy deployments terminating at 443. Apply the setting to existing websites and update HTTPS settings labels. (cherry picked from commit27c1468405) * feat(website): configure HTTPS redirect port per site Add a per-site HTTPS redirect port policy next to the HTTP-to-HTTPS option. Sites can inherit the global setting, use the Nginx HTTPS port, or force standard port 443, defaulting existing sites to inheritance. This supports reverse-proxied sites that need 443 and directly exposed sites that need 8443 on the same host. Global changes now update only inheriting sites, so adjusting one website does not rewrite other sites' redirect rules. Hide the global custom-port switch when Nginx uses standard port 443. (cherry picked from commit301dc15d9d) * Revert "feat(website): configure HTTPS redirect port per site" This reverts commit83d94f6cf9. The per-site database strategy will be replaced by a config-driven design. * feat(website): make HTTPS redirect port config-driven Read the site redirect port from managed nginx rules instead of storing per-site policy in the database. Only update rules matching the old global port, preserve manual configurations, and avoid rewriting sites when the global redirect setting is unchanged. --------- Co-authored-by: BOX <no@mail.com>
116 lines
4.0 KiB
Go
116 lines
4.0 KiB
Go
package response
|
|
|
|
import "github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
|
|
type NginxStatus struct {
|
|
Active int `json:"active"`
|
|
Accepts int `json:"accepts"`
|
|
Handled int `json:"handled"`
|
|
Requests int `json:"requests"`
|
|
Reading int `json:"reading"`
|
|
Writing int `json:"writing"`
|
|
Waiting int `json:"waiting"`
|
|
}
|
|
|
|
type NginxParam struct {
|
|
Name string `json:"name"`
|
|
Params []string `json:"params"`
|
|
// Source is the included file that sets an http-level directive missing
|
|
// from nginx.conf. Empty when the value comes from nginx.conf itself.
|
|
Source string `json:"source,omitempty"`
|
|
}
|
|
|
|
// NginxBrotliRes carries the brotli settings together with where they live.
|
|
// ManagedExternally is true when the user defined brotli by hand, in which
|
|
// case the panel only reports the values and must not write its own copy.
|
|
// ManagedPending is true when nginx does not load the managed configuration
|
|
// yet but saving will wire it in, so the reported values are not in effect
|
|
// until then.
|
|
// ManagedUnavailable is true when the panel cannot wire the managed
|
|
// configuration into nginx.conf at all, so the reported values are inert.
|
|
type NginxBrotliRes struct {
|
|
Params []NginxParam `json:"params"`
|
|
ManagedExternally bool `json:"managedExternally"`
|
|
ManagedPending bool `json:"managedPending"`
|
|
ManagedUnavailable bool `json:"managedUnavailable"`
|
|
}
|
|
|
|
type NginxAuthRes struct {
|
|
Enable bool `json:"enable"`
|
|
Items []dto.NginxAuth `json:"items"`
|
|
}
|
|
|
|
type NginxPathAuthRes struct {
|
|
dto.NginxPathAuth
|
|
}
|
|
|
|
type NginxAntiLeechRes struct {
|
|
Enable bool `json:"enable"`
|
|
Extends string `json:"extends"`
|
|
Return string `json:"return"`
|
|
ServerNames []string `json:"serverNames"`
|
|
Cache bool `json:"cache"`
|
|
CacheTime int `json:"cacheTime"`
|
|
CacheUint string `json:"cacheUint"`
|
|
NoneRef bool `json:"noneRef"`
|
|
LogEnable bool `json:"logEnable"`
|
|
Blocked bool `json:"blocked"`
|
|
}
|
|
|
|
type NginxRedirectConfig struct {
|
|
WebsiteID uint `json:"websiteID"`
|
|
Name string `json:"name"`
|
|
Domains []string `json:"domains"`
|
|
KeepPath bool `json:"keepPath"`
|
|
Enable bool `json:"enable"`
|
|
Type string `json:"type"`
|
|
Redirect string `json:"redirect"`
|
|
Path string `json:"path"`
|
|
Target string `json:"target"`
|
|
FilePath string `json:"filePath"`
|
|
Content string `json:"content"`
|
|
RedirectRoot bool `json:"redirectRoot"`
|
|
}
|
|
|
|
type NginxFile struct {
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type NginxProxyCache struct {
|
|
Open bool `json:"open"`
|
|
CacheLimit float64 `json:"cacheLimit"`
|
|
CacheLimitUnit string `json:"cacheLimitUnit" `
|
|
ShareCache int `json:"shareCache" `
|
|
ShareCacheUnit string `json:"shareCacheUnit" `
|
|
CacheExpire int `json:"cacheExpire" `
|
|
CacheExpireUnit string `json:"cacheExpireUnit" `
|
|
}
|
|
|
|
type NginxModule struct {
|
|
Name string `json:"name"`
|
|
Custom bool `json:"custom"`
|
|
Script string `json:"script"`
|
|
Packages string `json:"packages"`
|
|
Params string `json:"params"`
|
|
Enable bool `json:"enable"`
|
|
BuildMode string `json:"buildMode"`
|
|
Provider string `json:"provider"`
|
|
LoadOrder int `json:"loadOrder"`
|
|
BuildStatus string `json:"buildStatus"`
|
|
LoadStatus string `json:"loadStatus"`
|
|
Artifacts []dto.NginxModuleArtifact `json:"artifacts"`
|
|
LastError string `json:"lastError"`
|
|
}
|
|
|
|
type NginxBuildConfig struct {
|
|
Mirror string `json:"mirror"`
|
|
DynamicSupported bool `json:"dynamicSupported"`
|
|
Modules []NginxModule `json:"modules"`
|
|
}
|
|
|
|
type NginxConfigRes struct {
|
|
Https bool `json:"https"`
|
|
SSLRejectHandshake bool `json:"sslRejectHandshake"`
|
|
HTTPSRedirectCustomPort bool `json:"httpsRedirectCustomPort"`
|
|
}
|