fix(proxy): fetch failed (#10346)

* fix(backups): fetch failed

disable compresion between xoa on proxy on xoa side

* fix(xo-proxy): disable compression on the proxy

it was disable with hrp, replaced by #10038 since it was never
sending accept-encoding header

compression can be put back later on a route by route basis after
careful checks ( for example : file restore, backup listing )
This commit is contained in:
Florent BEAUCHAMP
2026-09-03 12:56:36 +02:00
committed by GitHub
parent bca8f02b8a
commit 003cc6f9cc
3 changed files with 24 additions and 5 deletions

View File

@@ -68,6 +68,15 @@ export default class Api {
// not be enough for the API. // not be enough for the API.
ctx.req.setTimeout(0) ctx.req.setTimeout(0)
// Compression is disabled for the whole API.
//
// A compressor buffers its input, so a streamed response would not reach the
// client as it is produced. With brotli — which `fetch` negotiates by default
// over HTTPS — nothing at all is emitted before its window fills, not even the
// response headers, and the client times out waiting for them.
//
ctx.compress = false
const profile = await app.authentication.findProfile({ const profile = await app.authentication.findProfile({
token: ctx.cookies.get('authenticationToken'), token: ctx.cookies.get('authenticationToken'),
}) })

View File

@@ -15,6 +15,8 @@
> Users must be able to say: "I had this issue, happy to know it's fixed" > Users must be able to say: "I had this issue, happy to know it's fixed"
- [Backups] Fix error `fetch failed` on backup with proxies (PR [#10346](https://github.com/vatesfr/xen-orchestra/pull/10346))
### Packages to release ### Packages to release
> When modifying a package, add it here with its release type. > When modifying a package, add it here with its release type.
@@ -31,4 +33,6 @@
<!--packages-start--> <!--packages-start-->
- @xen-orchestra/proxy patch
- xo-server patch
<!--packages-end--> <!--packages-end-->

View File

@@ -474,13 +474,19 @@ export default class Proxy {
const proxy = await this._getProxy(id) const proxy = await this._getProxy(id)
const url = new URL('https://localhost/api/v1') const url = new URL('https://localhost/api/v1')
const headers = {
const request = {
body: format.request(0, method, params),
headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Cookie: cookie.serialize('authenticationToken', proxy.authenticationToken), Cookie: cookie.serialize('authenticationToken', proxy.authenticationToken),
}, }
if (assertType !== 'scalar') {
// the proxy streams ndjson and binary responses incrementally; a compressor
// buffers them (brotli emits nothing until its window fills), so the response
// headers are never flushed and `headersTimeout` fires
headers['Accept-Encoding'] = 'identity'
}
const request = {
body: format.request(0, method, params),
headers,
method: 'POST', method: 'POST',
dispatcher: this._getAgent(timeout), dispatcher: this._getAgent(timeout),
} }