有办法代理 Google 的 API 吗

2022-05-28 13:48:40 +08:00
 LxnChan

想用 acme 申请 Google 的 SSL 证书,但是国内好像没有办法连接 Google 的 API 服务,用 Hosts 也不行。

在 cloudflare 搞了个 jsproxy 但是 curl 一下会返回代理页。

想问一下大家有没有什么好的解决方案。


需要请求的地址:https://dv.acme-v02.api.pki.goog/directory

应该返回的数据:

{"newNonce":"https://dv.acme-v02.api.pki.goog/new-nonce","newAccount":"https://dv.acme-v02.api.pki.goog/new-account","newOrder":"https://dv.acme-v02.api.pki.goog/new-order","newAuthz":"https://dv.acme-v02.api.pki.goog/new-authz","revokeCert":"https://dv.acme-v02.api.pki.goog/revoke-cert","meta":{"termsOfService":"https://pki.goog/GTS-SA.pdf","website":"https://pki.goog","caaIdentities":["pki.goog"],"externalAccountRequired":true}}

经过 jsproxy curl 到的数据:

root@lxnchan-testbench-vm93-hwcloud-cn:~# curl 'https://proxy.mydomain.top/-----https://dv.acme-v02.api.pki.goog/directory'
<html><head><meta charset=utf-8></head><body id=t><svg xmlns=http://www.w3.org/2000/svg width=100% height=100% viewBox="0 0 100 100" preserveAspectRatio=xMidYMid fill=none><circle cx=50 cy=50 r=25.944 stroke=#93dbe9><animate attributeName=r calcMode=spline values=0;40 keyTimes=0;1 dur=1 keySplines="0 0.2 0.8 1" begin=-0.5s repeatCount=indefinite stroke-width=2 /><animate attributeName=opacity calcMode=spline values=1;0 keyTimes=0;1 dur=1 keySplines="0.2 0 0.8 1" begin=-0.5s repeatCount=indefinite stroke-width=2 /></circle><circle cx=50 cy=50 r=40 stroke=#689cc5><animate attributeName=r calcMode=spline values=0;40 keyTimes=0;1 dur=1 keySplines="0 0.2 0.8 1" begin=0s repeatCount=indefinite stroke-width=2 /><animate attributeName=opacity calcMode=spline values=1;0 keyTimes=0;1 dur=1 keySplines="0.2 0 0.8 1" begin=0s repeatCount=indefinite stroke-width=2 /></circle></svg><script>function a(){var e=Date.now();try{var t=+sessionStorage._ts||0;if((sessionStorage._ts=e)-t<100)return setTimeout(a,5e3)}catch(r){}location.reload()}function i(e){n(e.message)}function n(e){t.innerHTML=e}!function s(){if(self.isSecureContext)if(self.ReadableStream){var e=navigator.serviceWorker;if(e)e.register(function r(){return location.pathname.replace(/\/-+https?:.+/,"").replace(/\w+\.\w+$/,"").replace(/\/*$/,"/")}()+"sw.js").then(a)["catch"](i);else{var t=navigator.userAgent;/Firefox/.test(t)?n("本网站不支持 FireFox 隐身模式"):/iPhone|iPad/.test(t)&&n("iOS 上请使用 Safari 浏览器")}}else n("请使用最新的 HTML5 浏览器");else n("本程序需要 HTTPS 站点")}()</script></body></html>
2470 次点击
所在节点    程序员
8 条回复
Kinnice
2022-05-28 16:04:43 +08:00
jsproxy 是基于 js 的(浏览器),你应该使用 tcp 代理
chxf
2022-05-28 16:13:04 +08:00
acme 跑 linux 上?搞个 https_proxy 可以的吧,不过我用 let's encrypt,域名在阿里云,不用代理。
zoharSoul
2022-05-28 17:06:37 +08:00
我也想知道, 比如接个三方登录之类的
SunsetShimmer
2022-05-28 19:32:19 +08:00
yankebupt
2022-05-28 23:23:13 +08:00
不懂瞎说
申请证书这个不是对方要验证你的发起 ip 地址和被申请地址是否同 ip 么?用代理 ip 是不是就变了?
还是我不知道有什么新的规定?
shansing
2022-05-29 10:51:06 +08:00
https://github.com/dlundquist/sniproxy/ 或者直接用 nginx 相关功能。


@yankebupt ACME 支持 HTTP 认证、DNS 认证,都是对方主动发起请求,跟请求 API 的 IP 地址无关。
cnrting
2022-05-29 15:51:46 +08:00
我试了 hosts 可以啊卤煮
Showfom
2022-05-29 20:20:46 +08:00
@yankebupt # 5 不需要

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/855841

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX