Skip to content

Node.js based forum software built for the modern web

fix: override ACAO header for read API spec file

Julian Lam240d90919b95
diff --git a/src/routes/index.js b/src/routes/index.js
index fcab003624..8c1ed9ba24 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -149,6 +149,11 @@ function addCoreRoutes(app, router, middleware) {
];
var staticOptions = {
maxAge: app.enabled('cache') ? 5184000000 : 0,
+ setHeaders: (res, filePath) => {
+ if (filePath === path.resolve(nconf.get('upload_path'), '../openapi/read.yaml')) {
+ res.set('Access-Control-Allow-Origin', '*');
+ }
+ },
};
if (path.resolve(__dirname, '../../public/uploads') !== nconf.get('upload_path')) {