Skip to content

Commit 96eb7be

Browse files
committed
gdocsviewer docs update: requestHeaders field
1 parent 56bb733 commit 96eb7be

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎docs/en_US/v5/config/stream/gdocsviewer.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ This protocol has not been fully tested prior to release.
5656
"textUrl": "https://drive.google.com/viewerng/text",
5757
"originUrl": "http://{rand}-0-0-0-0.sslip.io:8080/",
5858
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36",
59+
"requestHeaders": {
60+
"Accept-Language": "en-US,en;q=0.9",
61+
"Referer": "https://drive.google.com/"
62+
},
5963
"maxRequestBytes": 872,
6064
"originUrlReplacementRules": [
6165
{
@@ -145,6 +149,12 @@ If the server uses the default `pathPrefix`, the client `originUrl` should inclu
145149
146150
(Client only) `User-Agent` sent to Google Docs Viewer. You should use a real browser user agent to avoid google's blocking.
147151

152+
> `requestHeaders`: \{ \[key: string\]: string \}
153+
154+
(Client only) Extra HTTP request headers sent to `viewerUrl` and `textUrl`. This can be used to set browser-like headers such as `Accept-Language` or `Referer`. (v5.51.2+)
155+
156+
If `requestHeaders` contains `User-Agent`, it overrides `userAgent`. If it contains `Host`, it is handled as the HTTP Host header and overrides `viewerHostHeader`. These headers are sent only from the client to Google Docs Viewer; they do not control the headers that Google Docs Viewer sends to `originUrl`.
157+
148158
> `h2PoolSize`: number
149159
150160
(Client only) HTTP/2 connection pool size. The default is determined by the underlying HTTP round tripper.
@@ -201,5 +211,6 @@ The same rule generates one value per request and replaces all matching placehol
201211
* The outer client outbound target is normally an address that can reach Google services, used with TLS `serverName`.
202212
* `sharedKey` is recommended; without it, the origin path and response body are not protected by transport encryption.
203213
* This transport performs multiple HTTP requests and its performance and reliability depend on Google Docs Viewer behavior.
214+
* The direct `gdocsviewer` transport uses a request assembler with idle polling backoff and server-side long polling. Empty polls may wait before returning so idle connections do not continuously consume Google Docs Viewer quota.
204215

205-
(This document is generated with assist from LLM, and reviewed by author.)
216+
(This document is generated with assist from LLM, and reviewed by author.)

‎docs/v5/config/stream/gdocsviewer.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Google Docs Viewer Transport 是一种通过 Google Docs Viewer 承载请求的
5656
"textUrl": "https://drive.google.com/viewerng/text",
5757
"originUrl": "http://{rand}-0-0-0-0.sslip.io:8080/",
5858
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36",
59+
"requestHeaders": {
60+
"Accept-Language": "en-US,en;q=0.9",
61+
"Referer": "https://drive.google.com/"
62+
},
5963
"maxRequestBytes": 872,
6064
"originUrlReplacementRules": [
6165
{
@@ -145,6 +149,12 @@ Google Docs Viewer Transport 是一种通过 Google Docs Viewer 承载请求的
145149
146150
(仅客户端)发送给 Google Docs Viewer 的 `User-Agent`。建议使用真实浏览器的 User-Agent,以避免被 Google 阻止。
147151

152+
> `requestHeaders`: \{ \[key: string\]: string \}
153+
154+
(仅客户端)发送给 `viewerUrl` 和 `textUrl` 的额外 HTTP 请求头。可用于设置类似浏览器的请求头,例如 `Accept-Language` 或 `Referer`。 (v5.51.2+)
155+
156+
如果 `requestHeaders` 包含 `User-Agent`,它会覆盖 `userAgent`。如果包含 `Host`,它会作为 HTTP Host 头处理并覆盖 `viewerHostHeader`。这些请求头只用于客户端到 Google Docs Viewer 的请求;它们不会控制 Google Docs Viewer 访问 `originUrl` 时发送的请求头。
157+
148158
> `h2PoolSize`: number
149159
150160
(仅客户端)HTTP/2 连接池大小。默认值由底层 HTTP round tripper 决定。
@@ -201,5 +211,6 @@ Google Docs Viewer Transport 是一种通过 Google Docs Viewer 承载请求的
201211
* 客户端的外层出站目标通常应是可访问 Google 服务的地址,并配合 TLS `serverName` 使用。
202212
* 建议配置 `sharedKey`,否则源站路径和响应内容不具备传输层加密保护。
203213
* 此传输方式会产生多次 HTTP 请求,性能和可靠性受 Google Docs Viewer 行为影响。
214+
* 直接使用 `gdocsviewer` 传输时会使用带有空闲轮询退避和服务端长轮询的 request assembler。空轮询请求可能会等待一段时间后才返回,以避免空闲连接持续消耗 Google Docs Viewer 配额。
204215

205216
(本文档由 LLM 协助生成,并经作者审阅。)

0 commit comments

Comments
 (0)