mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #2086] Forward subdomain based TCP Connections like ngrok #1661
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#1661
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 @schedutron on GitHub (Nov 19, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/2086
First of all, thanks for building frp! It is of great utility for several of my projects.
The solution you want
I want to build a reverse proxy server that redirects TCP connections to different Raspberry Pi's based on the subdomain value. For example, if server's domain is frptest.com and I have 3 Raspberry Pi's I named
pi-a,pi-b,pi-c, then I wantpi-a.frptest.comgetting routed to first Pipi-b.frptest.comgetting routed to second Pi, and so on.I was able to do this successfully for HTTP requests by following this frp + nginx tutorial, but the server code running on my Pi's does not accept HTTP requests, it only accepts TCP ones.
Alternatives considered
I tried to use
ngrokfor this, by runningngrok tcp 8888on each of my Raspberry Pi's. Now incoming TCP requests (which to be specific are for remote GPIO access) to the url ngrok provides (e.g.tcp://4.tcp.ngrok.io:18155) are routed successfully to the specific Pi.I do not want to use ngrok because
frpis more versatile.I went through the README, but could not figure out a way to implement this.
Please point me to the correct documentation or
frps/frpcconfiguration to make this possible. Thanks! 🙏@fatedier commented on GitHub (Nov 20, 2020):
tcp://4.tcp.ngrok.io:18155It routes requests also by port?https://github.com/fatedier/frp#access-your-computer-in-lan-by-ssh This will help you forward request to different Raspberry Pi's by port.
If you want to reuse the same port, this feature https://github.com/fatedier/frp#tcp-port-multiplexing can help you. However, you should connect your Raspberry Pi's by HTTP CONNECT protocol. The host of the HTTP CONNECT request will be used to match the proxy in frps.
@schedutron commented on GitHub (Nov 22, 2020):
Thanks for the quick response @fatedier. Let me try that SSH approach with the GPIO server on my Raspberry Pi's (so the service won't be SSH but instead the remote GPIO service). Just wondering if using custom domains is possible with that approach (something like using
subdomain_hostconfig in conjunction with https://github.com/fatedier/frp#access-your-computer-in-lan-by-ssh). Will get back to you soon on this.@fatedier commented on GitHub (Nov 23, 2020):
@schedutron It's not supported because no domain info is transfered in TCP protocol directly.
For HTTP, it transfers domain info in
Hostheader.For
tcpmux(http connect), it transfers domain info inHTTP CONNECThost header.frps should have a way to detect the domain info, so it can redirect your requests to correct backends.
@schedutron commented on GitHub (Nov 27, 2020):
I see. Thanks for your prompt help! So I will only use frp for ssh purposes now - in a manner similar to the strategy in issue #338 , and will install a local client on each Raspberry Pi to interact with GPIO.