[GH-ISSUE #4927] Cannot proxy service exposed by frp in nginx #3887

Closed
opened 2026-05-05 14:28:55 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @HawtinZeng on GitHub (Aug 11, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4927

Bug Description

Returns 404 after we request proxied backend interface.

frpc Version

0.63.0

frps Version

0.63.0

System Architecture

linux/amd64

Configurations

part of the nginx config:

location /api/ {
proxy_pass http://api.hawtin.me:8085/;
proxy_set_header Host $host; # Important: Preserve original Host header
# proxy_set_header X-Forwarded-For $realip_remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr; # Optional: Forward client's IP
}

frps config:

bindPort = 7000
vhostHTTPPort = 8085

frpc confg:

serverAddr = "38.180.149.57"
serverPort = 7000

proxies
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000

proxies
name = "back-hawtin-blog"
type = "http"
localIP = "127.0.0.1"
localPort = 3006
customDomains = ["18.120.139.17","api.hawtin.me"]

Logs

No response

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @HawtinZeng on GitHub (Aug 11, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4927 ### Bug Description Returns 404 after we request proxied backend interface. ### frpc Version 0.63.0 ### frps Version 0.63.0 ### System Architecture linux/amd64 ### Configurations part of the nginx config: location /api/ { proxy_pass http://api.hawtin.me:8085/; proxy_set_header Host $host; # Important: Preserve original Host header # proxy_set_header X-Forwarded-For $realip_remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Real-IP $remote_addr; # Optional: Forward client's IP } frps config: bindPort = 7000 vhostHTTPPort = 8085 frpc confg: serverAddr = "38.180.149.57" serverPort = 7000 [[proxies]] name = "ssh" type = "tcp" localIP = "127.0.0.1" localPort = 22 remotePort = 6000 [[proxies]] name = "back-hawtin-blog" type = "http" localIP = "127.0.0.1" localPort = 3006 customDomains = ["18.120.139.17","api.hawtin.me"] ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [x] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@HawtinZeng commented on GitHub (Aug 12, 2025):

It's seems like frp will check whether $host in http header is included in the customDomains in frpc.toml. I resolved this problem by comment proxy_set_header Host $host; # Important: Preserve original Host header in nginx config or add replace api.hawtin.me with hawtin.me in frpc.toml customDomains fields.

<!-- gh-comment-id:3179246237 --> @HawtinZeng commented on GitHub (Aug 12, 2025): It's seems like frp will check whether $host in http header is included in the customDomains in frpc.toml. I resolved this problem by comment `proxy_set_header Host $host; # Important: Preserve original Host header` in nginx config or add replace `api.hawtin.me` with `hawtin.me` in frpc.toml customDomains fields.
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: github-starred/frp#3887
No description provided.