13 / removed getting host from env
13 / traefik vless reality/grpc labels
This commit is contained in:
serogaq 2024-12-16 14:49:45 +03:00
parent 10d6687aea
commit 7ef6b9461e
No known key found for this signature in database
GPG key ID: 6657A27160536D7E
3 changed files with 15 additions and 14 deletions

View file

@ -4,7 +4,8 @@ BUILD_WITH_ANTIZAPRET="0"
XUI_SERVER_IP=""
XUI_PANEL_DOMAIN=""
XUI_SUB_DOMAIN=""
XUI_VLESS_SNI=""
XUI_VLESS_REALITY_SNI=""
XUI_VLESS_GRPC_SNI=""
#XUI_SUB_PROFILE_TITLE=""
#XUI_SUB_SUPPORT_URL=""
#XUI_SUB_PROFILE_WEB_PAGE_URL=""

View file

@ -24,10 +24,16 @@ services:
- "traefik.http.routers.3x-ui-sub.entrypoints=https"
- "traefik.http.services.3x-ui-sub.loadbalancer.server.port=2096"
#
- "traefik.tcp.routers.vless.rule=HostSNI(`${XUI_VLESS_SNI}`)"
- "traefik.tcp.routers.vless.tls.passthrough=true"
- "traefik.tcp.routers.vless.service=3x-ui-inbound-443"
- "traefik.tcp.routers.vless-reality.rule=HostSNI(`${XUI_VLESS_REALITY_SNI}`)"
- "traefik.tcp.routers.vless-reality.tls.passthrough=true"
- "traefik.tcp.routers.vless-reality.service=3x-ui-inbound-443"
- "traefik.tcp.services.3x-ui-inbound-443.loadbalancer.server.port=443"
#
- "traefik.tcp.routers.vless-grpc.rule=HostSNI(`${XUI_VLESS_GRPC_SNI}`)"
- "traefik.tcp.routers.vless-grpc.tls.passthrough=true"
- "traefik.tcp.routers.vless-grpc.entrypoints=https"
- "traefik.tcp.routers.vless-grpc.service=3x-ui-inbound-8888"
- "traefik.tcp.services.3x-ui-inbound-8888.loadbalancer.server.port=8888"
volumes:
- ./db/:/etc/x-ui/
- ./db/fail2ban.sqlite3:/var/lib/fail2ban/fail2ban.sqlite3

View file

@ -59,11 +59,8 @@ func (a *SUBController) initRouter(g *gin.RouterGroup) {
func (a *SUBController) subs(c *gin.Context) {
subId := c.Param("subid")
var host string
host = os.Getenv("XUI_SERVER_IP")
if host == "" {
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
if host == "" {
host = c.GetHeader("X-Real-IP")
@ -122,11 +119,8 @@ func (a *SUBController) subs(c *gin.Context) {
func (a *SUBController) subJsons(c *gin.Context) {
subId := c.Param("subid")
var host string
host = os.Getenv("XUI_SERVER_IP")
if host == "" {
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
host = h
}
if host == "" {
host = c.GetHeader("X-Real-IP")