mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix service.js
This commit is contained in:
+3
-5
@@ -22,17 +22,15 @@ app.use(
|
|||||||
proxyReqPathResolver: (req) => {
|
proxyReqPathResolver: (req) => {
|
||||||
return `/api${req.url}`
|
return `/api${req.url}`
|
||||||
},
|
},
|
||||||
// 动态设置超时时间:SSE无超时,普通请求600秒超时
|
|
||||||
timeout: (req) => {
|
|
||||||
const isSSE = req.headers.accept && req.headers.accept.includes('text/event-stream');
|
|
||||||
return isSSE ? 0 : 600000;
|
|
||||||
},
|
|
||||||
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
|
||||||
proxyReqOpts.headers = proxyReqOpts.headers || {};
|
proxyReqOpts.headers = proxyReqOpts.headers || {};
|
||||||
|
|
||||||
// 检测是否为SSE请求
|
// 检测是否为SSE请求
|
||||||
const isSSE = srcReq.headers.accept && srcReq.headers.accept.includes('text/event-stream');
|
const isSSE = srcReq.headers.accept && srcReq.headers.accept.includes('text/event-stream');
|
||||||
|
|
||||||
|
// 动态设置超时时间:SSE无超时,普通请求600秒超时
|
||||||
|
proxyReqOpts.timeout = isSSE ? 0 : 600000;
|
||||||
|
|
||||||
if (isSSE) {
|
if (isSSE) {
|
||||||
// SSE请求的特殊头部设置
|
// SSE请求的特殊头部设置
|
||||||
proxyReqOpts.headers['Cache-Control'] = 'no-cache';
|
proxyReqOpts.headers['Cache-Control'] = 'no-cache';
|
||||||
|
|||||||
Reference in New Issue
Block a user