mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #3831] Unable to Access frp Service Behind Nginx Reverse Proxy #3043
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#3043
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FerrazArthur on GitHub (Dec 6, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3831
Bug Description
I'm facing an issue where I cannot access the frp service when it's behind an Nginx reverse proxy. I've reduced the problem to a curl command, and it seems to be related to communication issues with how to access the upstream frp server.
From within the frps container, i can access the service with customDomain:/URL. YET i want to know how to access it with a call to 0.0.0.0:port/URL. like a curl -H "Host: customDomain" 0.0.0.0:port/URL should work.
This is important so i can mannage tls certificates with nginx, then pass it as http to frpserver. them return the response from frpserver to the user as https.
frpc Version
v0.52.3
frps Version
v0.52.3
System Architecture
linux/amd64, frpc and frps container's are alpine
Configurations
FRP FILES
FRPS.toml
FRPC.toml
Exact setup of problem
nginx file:
dnsmasq file:
I's a local dns server so for this to work you'll need to pause systemd.resolved with
sudo systemctl stop systemd-resolvedbecause it'll already be listenning of port 53. Also you'll need to add 127.0.0.1 to your dns list, in priority and probably change /etc/resolv.conf from 127.0.0.53 to 127.0.0.1. when you restart systemd-resolved, all goes back to normal.traefik file:
docker compose
by running this, you'll see that nginx-server logs are showing:
everytime you try https://my-app.test/URL.
Logs
with nginx
with curl (that's inside the frp-server container)
Steps to reproduce
You can either run the services and test with nginx, or you can run only the frps server and frpc client containers and try to access the service from the frps Ip:port, like
curl -H "Host: service domain host" frpsip:frpsport/URLAffected area
@fatedier commented on GitHub (Dec 7, 2023):
Please first try to verify the configuration according to the document example.
@FerrazArthur commented on GitHub (Dec 7, 2023):
I read it multiple times already and made some changes as setting frps httpvhost to 8080 and also tried setting the client proxy for remotePort 8080, but had the same result. This time i took a picture

I think would be great to add in the documentation how to communicate directly to the frp's server, via it's ip:port, and access a service. I think this should work, passing the customDomain of the proxy as Host, yet cant make it work.
I thought it listens for the customDomain's, but it has to go thought some ip or port and i couldnt figure out how to mimic this in order to curl -k -H "customDomain" frps-ip:port/ sucessfully.
frp toml's
nginx
@superzjg commented on GitHub (Dec 8, 2023):
If using
type = "http", there is no need to setremotePortand it will automatically be set tovhostHTTPPort.When using
type = "tcp", aremotePortneeds to be set.@xqzr commented on GitHub (Dec 8, 2023):
curl -H "Host: service domain host" frpsip:80/URL@FerrazArthur commented on GitHub (Dec 8, 2023):
It started working when i redirected to port 8080 and removed remotePort from client. Thanks for the help, really appreciate you all.