Skip to content

Commit 68271c0

Browse files
authored
fix: 修复Plugin代理服务在处理通过nginx转发部署的Plugin服务时,req.headers中的host会导致返回404. (#5801)
问题场景: 当Plugin服务不是直接通过ip\docker内路由直接访问,而是通过nginx做域名转发的方式部署时,30行headers: req.headers会直接将host(此时host=fastgpt主项目的域名)带入,nginx会使用host值判断转发路由,而导致请求无法被正确转发到plugin项目中。 此次修改参照了projects/app/src/pages/api/lafApi/[...path].ts中的做法,同时删除了cookie\host\origin三个header
1 parent 038fee2 commit 68271c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

projects/app/src/pages/api/system/plugin/[...path].ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
1717

1818
const parsedUrl = new URL(FastGPTPluginUrl);
1919
delete req.headers?.rootkey;
20+
delete req.headers?.cookie;
21+
delete req.headers?.host;
22+
delete req.headers?.origin;
2023

2124
const requestResult = request({
2225
protocol: parsedUrl.protocol,

0 commit comments

Comments
 (0)