[PR #2292] [MERGED] feat: Enhance host extraction from headers #5079

Closed
opened 2026-10-31 20:44:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/2292
Author: @najahiiii
Created: 5/23/2024
Status: ✅ Merged
Merged: 5/23/2024
Merged by: @MHSanaei

Base: main ← Head: fix-2284


📝 Commits (1)

  • 0718dcf feat: Enhance host extraction from headers

📊 Changes

3 files changed (+46 additions, -9 deletions)

View changed files

📝 sub/subController.go (+24 -2)
📝 web/controller/util.go (+12 -1)
📝 web/middleware/domainValidator.go (+10 -6)

📄 Description

  • Refactor SUBController subs and subJsons methods to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host if unavailable.
  • Update html function to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host if unavailable.
  • Update DomainValidatorMiddleware to first attempt to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host.

Fixes: #2284


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/2292 **Author:** [@najahiiii](https://github.com/najahiiii) **Created:** 5/23/2024 **Status:** ✅ Merged **Merged:** 5/23/2024 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix-2284` --- ### 📝 Commits (1) - [`0718dcf`](https://github.com/MHSanaei/3x-ui/commit/0718dcf3217363d82636ed7727f265bb98995e65) feat: Enhance host extraction from headers ### 📊 Changes **3 files changed** (+46 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `sub/subController.go` (+24 -2) 📝 `web/controller/util.go` (+12 -1) 📝 `web/middleware/domainValidator.go` (+10 -6) </details> ### 📄 Description - Refactor SUBController subs and subJsons methods to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host if unavailable. - Update html function to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host if unavailable. - Update DomainValidatorMiddleware to first attempt to extract host from X-Forwarded-Host header, falling back to X-Real-IP header and then to the request host. Fixes: #2284 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:44:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5079
No description provided.