mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-09-10 22:14:48 -05:00
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:
committed by
GitHub
parent
bca8f02b8a
commit
003cc6f9cc
@@ -68,6 +68,15 @@ export default class Api {
|
||||
// not be enough for the API.
|
||||
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({
|
||||
token: ctx.cookies.get('authenticationToken'),
|
||||
})
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
> 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
|
||||
|
||||
> When modifying a package, add it here with its release type.
|
||||
@@ -31,4 +33,6 @@
|
||||
|
||||
<!--packages-start-->
|
||||
|
||||
- @xen-orchestra/proxy patch
|
||||
- xo-server patch
|
||||
<!--packages-end-->
|
||||
|
||||
@@ -474,13 +474,19 @@ export default class Proxy {
|
||||
const proxy = await this._getProxy(id)
|
||||
|
||||
const url = new URL('https://localhost/api/v1')
|
||||
|
||||
const request = {
|
||||
body: format.request(0, method, params),
|
||||
headers: {
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
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',
|
||||
dispatcher: this._getAgent(timeout),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user