Skip to content

[Feature Request] add ability to strip prefix for http type proxy #4981

@cayspekko

Description

@cayspekko

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions