Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpGet support Alt-Svc #3

Merged
merged 3 commits into from
Oct 16, 2023
Merged

HttpGet support Alt-Svc #3

merged 3 commits into from
Oct 16, 2023

Conversation

zhangnew
Copy link
Contributor

The Alt-Svc HTTP header allows a server to indicate that another network location (the "alternative service") can be treated as authoritative for that origin when making future requests.

see also https://httpwg.org/specs/rfc7838.html

@naiba
Copy link
Member

naiba commented Oct 16, 2023

这东西有人在用吗

@zhangnew
Copy link
Contributor Author

我也是最最近才发现的,这样访问家宽的服务就不需要加端口了,域名指向公网用 443 端口的服务,AltSvc 域名指向家宽的任意端口,只需要消耗一点点公网流量就能访问家宽服务。

@naiba
Copy link
Member

naiba commented Oct 16, 2023 via email

@zhangnew
Copy link
Contributor Author

对的,agent 先访问公网 443 域名得到 AltSvc 的家宽域名和端口,再去测试一下家宽,都没问题返回成功

@naiba
Copy link
Member

naiba commented Oct 16, 2023 via email

@zhangnew
Copy link
Contributor Author

这个家宽的服务是通过 lan-expose 暴露在同一个端口,直接请求的话需要几个 header 才可以,agent 也不支持加 header, 没想到其他好的办法了

header 示例:

curl -H "Connection: Upgrade" -H "Upgrade: x.example.com" -H "Host: x.example.com" https://home.example.com:690

Copy link
Member

@naiba naiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你确实需要,优化下代码

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
@naiba naiba merged commit 2b565e8 into nezhahq:main Oct 16, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants