add port config

This commit is contained in:
2024-10-06 12:28:02 +08:00
parent 12e5184126
commit 9588217de4
6 changed files with 282 additions and 16 deletions

View File

@@ -76,13 +76,19 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
if (_api === 'api') {
// 代理到 http://codeflow.xiongxiao.me/api
// 设置代理请求的目标 URL 和请求头
let header: any = {};
if (req.headers?.['Authroization']) {
header.Authorization = req.headers?.['Authroization'];
}
if (req.headers?.['Content-Type']) {
header['Content-Type'] = req.headers?.['Content-Type'];
}
const options = {
host: api.host,
path: req.url,
method: 'POST',
headers: {
'Content-Type': req.headers['content-type'],
Authroization: req.headers?.['authorization'] || '',
...header,
},
};
// 创建代理请求