[GH-ISSUE #4981] [Feature Request] add ability to strip prefix for http type proxy #3926

Closed
opened 2026-05-05 14:30:11 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @cayspekko on GitHub (Sep 15, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4981

Describe the feature request

Please add prefix stripping to frp http proxy type (similar to static_file)

I typically use frp http proxy similar to

serverAddr = "frp.example.com"
serverPort = 7000

[[proxies]]
name = "fast"
type = "http"
localIP = "127.0.0.1"
localPort = 5000
customDomains = ["frp.example.com"]
locations = ["/r/fast"]

then I navigate to
frp.example.com/r/fast to get to my proxied page. However, this requirers my target application to be aware that the incoming http path is /r/fast, which can be inconvenient.

I've added the ability to "strip prefix" for any locations defined. This is useful if the target can't be aware of paths and expects paths at /

obviously there are tonsof other ways get around this outside of frp, but usually involves adding another reverse proxy in the chain. I find it convenient for my usecase to have the prefix stripping ability built into frp.

I'm using this config instead:

name = "fast"
type = "http"
localIP = "127.0.0.1"
localPort = 5000
customDomains = ["frp.example.com"]
locations = ["/r/fast"]
stripPrefix = true

this specifically will strip any locations defined in locations

The strip logic is implemented in http.go in the same block that we rewrite the host when requested.

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @cayspekko on GitHub (Sep 15, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4981 ### Describe the feature request Please add prefix stripping to frp http proxy type (similar to static_file) I typically use frp http proxy similar to ``` serverAddr = "frp.example.com" serverPort = 7000 [[proxies]] name = "fast" type = "http" localIP = "127.0.0.1" localPort = 5000 customDomains = ["frp.example.com"] locations = ["/r/fast"] ``` then I navigate to frp.example.com/r/fast to get to my proxied page. However, this requirers my target application to be aware that the incoming http path is /r/fast, which can be inconvenient. I've added the ability to "strip prefix" for any locations defined. This is useful if the target can't be aware of paths and expects paths at / obviously there are tonsof other ways get around this outside of frp, but usually involves adding another reverse proxy in the chain. I find it convenient for my usecase to have the prefix stripping ability built into frp. I'm using this config instead: ``` name = "fast" type = "http" localIP = "127.0.0.1" localPort = 5000 customDomains = ["frp.example.com"] locations = ["/r/fast"] stripPrefix = true ``` this specifically will strip any locations defined in locations The strip logic is implemented in http.go in the same block that we rewrite the host when requested. ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [x] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:30:11 -06:00
Author
Owner

@fatedier commented on GitHub (Sep 16, 2025):

Right now, frp isn’t a fully featured L7 proxy.

We don’t plan to add such features one by one for the time being. You can prioritize using it together with other proxies.

<!-- gh-comment-id:3294644781 --> @fatedier commented on GitHub (Sep 16, 2025): Right now, frp isn’t a fully featured L7 proxy. We don’t plan to add such features one by one for the time being. You can prioritize using it together with other proxies.
Author
Owner

@cayspekko commented on GitHub (Sep 16, 2025):

Very well, I will fork this project, implementing this functionality, and until such time it makes sense to add similar prefix stripping like in the static file plugin, I will open a PR.

<!-- gh-comment-id:3299046380 --> @cayspekko commented on GitHub (Sep 16, 2025): Very well, I will fork this project, implementing this functionality, and until such time it makes sense to add similar prefix stripping like in the static file plugin, I will open a PR.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 1, 2025):

Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.

<!-- gh-comment-id:3354265747 --> @github-actions[bot] commented on GitHub (Oct 1, 2025): Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
Author
Owner

@CuWoMayr commented on GitHub (Mar 27, 2026):

@cayspekko I saw your fork and tried it using your built Docker Container. It worked flawlessly.
Do you still intend to open a Pull Request?

<!-- gh-comment-id:4142913084 --> @CuWoMayr commented on GitHub (Mar 27, 2026): @cayspekko I saw your fork and tried it using your built Docker Container. It worked flawlessly. Do you still intend to open a Pull Request?
Author
Owner

@cayspekko commented on GitHub (Apr 3, 2026):

@CuWoMayr I will try to open a Pull Request and see if it gets accepted

here: https://github.com/fatedier/frp/pull/5276

<!-- gh-comment-id:4181119994 --> @cayspekko commented on GitHub (Apr 3, 2026): @CuWoMayr I will try to open a Pull Request and see if it gets accepted here: https://github.com/fatedier/frp/pull/5276
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#3926
No description provided.