mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #4563] [Feature Request] Support h2c in vhost server #3609
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#3609
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 @sword-jin on GitHub (Nov 28, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4563
Describe the feature request
Like the title, we can enable
h2csupport in vhost server, there is a PR alreadyhttps://github.com/fatedier/frp/pull/4561
Describe alternatives you've considered
No response
Affected area
@sword-jin commented on GitHub (Nov 28, 2024):
@fatedier I think it's safe to wrapper the
handlerwithh2cif we don't want to introduce new optional parameter@fatedier commented on GitHub (Nov 28, 2024):
Could you provide relevant documentation or examples from other projects? Also, please add an end-to-end (e2e) test case to ensure existing functionality is not affected.
@sword-jin commented on GitHub (Nov 28, 2024):
I see, I will write a e2e test case, I think we can see the real user case in the e2e case
@sword-jin commented on GitHub (Nov 29, 2024):
I can't reprocude the bug when running all the components locally, this is my playground
be0c28f7a1/cmd/client/main.go (L46)This diagram Illuminates how a request reach out the local server. This repo trys to build the same worfklow, but fortunately it doesn't work.
In the playground, we use a mock certificate, and the client skip the validation
When the frps and caddy on real cloud with a real tls certificate, the client always gets
stream error: internal: protocol error: no Grpc-Status trailer: unexpected EOFatbe0c28f7a1/cmd/client/main.go (L46-L48)Form the logs of caddy and frps and local server, the request has been handled successfully, the problem is the trailer header is missing.
What I did to fix is add a h2c layer in frp vhost server and use
http2 transportI check the frps's response, left is without h2c, right is with h2c, the difference is left doesn't have
Trailer:Grpc-Statuswhich cause the error@fatedier commented on GitHub (Dec 5, 2024):
Can the code be modified in this way? And verify that it does not affect other requests?
@sword-jin commented on GitHub (Dec 13, 2024):
"golang.org/x/net/http2/h2c"is completely compatible to the existing http1.1, we can verify it doesn't affect all the current behavior(by current e2e testbut for http2.transparent, we need another option flag
@fatedier commented on GitHub (Dec 13, 2024):
A quick look shows that server-side support for h2c seems compatible and can be directly added. However, proxying to the backend using http2.Transport is incompatible. Perhaps we could split the work and submit the former first.
For proxying to the backend, there are two main approaches to consider:
Achieving compatibility with both, possibly through an upgrade mechanism or a fallback mechanism.
Allowing the backend service to configure its own interaction protocol.
I prefer the second approach, but the current code has limited support in this regard. There has always been a plan for future refactoring to provide more fine-grained configuration support.
@sword-jin commented on GitHub (Dec 13, 2024):
I agree, https://github.com/fatedier/frp/pull/4582 adding h2c wapper is compatible, for http2.Transport, I'd like to take a deep look or you can support the second approach if you are free.
@github-actions[bot] commented on GitHub (Dec 28, 2024):
Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.