[GH-ISSUE #2188] An option to enable TCP KeepAlived for HTTP? #1743

Closed
opened 2026-05-05 13:07:11 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @LauTrond on GitHub (Jan 13, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2188

The solution you want

Offer an option of type=http, enable TCP KeepAlived for HTTP

Alternatives considered

I found frps make every HTTP request with a single connection, even if both HTTP client and server support Connection: keep-alive
Then I look into vhost/http.go, looks like the vhost disable keep-alived for all requests:

proxy := &ReverseProxy{
    ...
    Transport: &http.Transport{
        ...
        DisableKeepAlives: true

How to implement this function

Application scenarios of this function

We want FRP works faster of HTTP, don't we?

Originally created by @LauTrond on GitHub (Jan 13, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2188 <!-- From Chinese to English by machine translation, welcome to revise and polish. --> **The solution you want** <!--A clear and concise description of the solution you want. --> Offer an option of type=http, enable TCP KeepAlived for HTTP **Alternatives considered** <!--A clear and concise description of any alternative solutions or features you have considered. --> I found frps make every HTTP request with a single connection, even if both HTTP client and server support `Connection: keep-alive` Then I look into vhost/http.go, looks like the vhost disable keep-alived for all requests: ``` proxy := &ReverseProxy{ ... Transport: &http.Transport{ ... DisableKeepAlives: true ``` **How to implement this function** <!--Implementation steps for the solution you want. --> **Application scenarios of this function** <!--Make a clear and concise description of the application scenario of the solution you want. --> We want FRP works faster of HTTP, don't we?
gitea-mirror 2026-05-05 13:07:11 -06:00
Author
Owner

@fatedier commented on GitHub (Jan 13, 2021):

It can't be supported now.

Go http package reuse connections by host. However, frp can route request by host and location(url path). If DisableKeepAlives is false, it will cause mistakes.

Leave this issue open here and we can consider how to achieve it later.

<!-- gh-comment-id:759420854 --> @fatedier commented on GitHub (Jan 13, 2021): It can't be supported now. Go http package reuse connections by host. However, frp can route request by host and location(url path). If `DisableKeepAlives` is false, it will cause mistakes. Leave this issue open here and we can consider how to achieve it later.
Author
Owner

@LauTrond commented on GitHub (Jan 14, 2021):

It can't be supported now.

Go http package reuse connections by host. However, frp can route request by host and location(url path). If DisableKeepAlives is false, it will cause mistakes.

Leave this issue open here and we can consider how to achieve it later.

Thanks. Sounds like we need multiple *ReverseProxy for multiple destination?

<!-- gh-comment-id:759905674 --> @LauTrond commented on GitHub (Jan 14, 2021): > It can't be supported now. > > Go http package reuse connections by host. However, frp can route request by host and location(url path). If `DisableKeepAlives` is false, it will cause mistakes. > > Leave this issue open here and we can consider how to achieve it later. Thanks. Sounds like we need multiple *ReverseProxy for multiple destination?
Author
Owner

@fatedier commented on GitHub (Jan 18, 2021):

@LauTrond I have submited a PR https://github.com/fatedier/frp/pull/2199 about to fix this issue, you can try it now and help find if it has bug.

<!-- gh-comment-id:762276181 --> @fatedier commented on GitHub (Jan 18, 2021): @LauTrond I have submited a PR https://github.com/fatedier/frp/pull/2199 about to fix this issue, you can try it now and help find if it has bug.
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#1743
No description provided.