mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-18 20:35:56 +08:00
fix: options handling in stand-alone script
This commit is contained in:
parent
0f36fe81a6
commit
033a53af30
9
backend/functions/package-lock.json
generated
9
backend/functions/package-lock.json
generated
@ -16,7 +16,7 @@
|
||||
"axios": "^1.3.3",
|
||||
"bcrypt": "^5.1.0",
|
||||
"busboy": "^1.6.0",
|
||||
"civkit": "^0.8.2-03243fe",
|
||||
"civkit": "^0.8.3-3e69606",
|
||||
"core-js": "^3.37.1",
|
||||
"cors": "^2.8.5",
|
||||
"dayjs": "^1.11.9",
|
||||
@ -3979,10 +3979,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/civkit": {
|
||||
"version": "0.8.2-03243fe",
|
||||
"resolved": "https://registry.npmjs.org/civkit/-/civkit-0.8.2-03243fe.tgz",
|
||||
"integrity": "sha512-hoTxGeGdD27iOCDi51cVY0PHlRN3OSC640QRJ1YSmD42o+LP7mZtbdy8dN7j/FSkPP/5yLuB2ch9BMSOp54POQ==",
|
||||
"license": "AGPL",
|
||||
"version": "0.8.3-3e69606",
|
||||
"resolved": "https://registry.npmjs.org/civkit/-/civkit-0.8.3-3e69606.tgz",
|
||||
"integrity": "sha512-niV5U11ySIiVNSnGpW49KJlExmIiuQQfnyQEXeYuKCE+B+wkqYCBG+3tlY3E882tmPkaQQKpDlF/yTeqEU2q2Q==",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21",
|
||||
"tslib": "^2.5.0"
|
||||
|
@ -36,7 +36,7 @@
|
||||
"axios": "^1.3.3",
|
||||
"bcrypt": "^5.1.0",
|
||||
"busboy": "^1.6.0",
|
||||
"civkit": "^0.8.2-03243fe",
|
||||
"civkit": "^0.8.3-3e69606",
|
||||
"core-js": "^3.37.1",
|
||||
"cors": "^2.8.5",
|
||||
"dayjs": "^1.11.9",
|
||||
|
@ -98,6 +98,16 @@ export class CrawlStandAloneServer extends ExpressServer {
|
||||
};
|
||||
}
|
||||
|
||||
makeIgnoreOPTIONSMiddleware() {
|
||||
return (req: Request, res: Response, next: NextFunction) => {
|
||||
if (req.method === 'OPTIONS') {
|
||||
return res.status(200).end();
|
||||
}
|
||||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
||||
override listen(port: number) {
|
||||
const r = super.listen(port);
|
||||
if (this.httpAlternativeServer) {
|
||||
@ -132,7 +142,12 @@ export class CrawlStandAloneServer extends ExpressServer {
|
||||
res.end(JSON.stringify(content));
|
||||
});
|
||||
|
||||
this.expressRootRouter.use('/', ...this.registry.expressMiddlewares, this.makeAssetsServingController(), this.registry.makeShimController('crawl'));
|
||||
this.expressRootRouter.use('/',
|
||||
...this.registry.expressMiddlewares,
|
||||
this.makeAssetsServingController(),
|
||||
this.makeIgnoreOPTIONSMiddleware(),
|
||||
this.registry.makeShimController('crawl')
|
||||
);
|
||||
}
|
||||
|
||||
protected override featureSelect(): void {
|
||||
|
@ -98,6 +98,16 @@ export class SearchStandAloneServer extends ExpressServer {
|
||||
};
|
||||
}
|
||||
|
||||
makeIgnoreOPTIONSMiddleware() {
|
||||
return (req: Request, res: Response, next: NextFunction) => {
|
||||
if (req.method === 'OPTIONS') {
|
||||
return res.status(200).end();
|
||||
}
|
||||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
||||
override listen(port: number) {
|
||||
const r = super.listen(port);
|
||||
if (this.httpAlternativeServer) {
|
||||
@ -132,7 +142,12 @@ export class SearchStandAloneServer extends ExpressServer {
|
||||
res.end(JSON.stringify(content));
|
||||
});
|
||||
|
||||
this.expressRootRouter.use('/', ...this.registry.expressMiddlewares, this.makeAssetsServingController(), this.registry.makeShimController('search'));
|
||||
this.expressRootRouter.use('/',
|
||||
...this.registry.expressMiddlewares,
|
||||
this.makeIgnoreOPTIONSMiddleware(),
|
||||
this.makeAssetsServingController(),
|
||||
this.registry.makeShimController('search')
|
||||
);
|
||||
}
|
||||
|
||||
protected override featureSelect(): void {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1463a18b1c039e5c0d1073998a8d6953f811406d
|
||||
Subproject commit 34e1550a985fe416736420fd6e8dc2f7661b51be
|
Loading…
x
Reference in New Issue
Block a user