cors work
This commit is contained in:
parent
a52e39a0e6
commit
c328e69476
|
@ -15,15 +15,9 @@ app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
app.use(express.static("public"));
|
app.use(express.static("public"));
|
||||||
app.use(cors({
|
app.use(cors({
|
||||||
// origin: "*",
|
|
||||||
origin: inProd ? /\.lingdocs\.com$/ : "*",
|
origin: inProd ? /\.lingdocs\.com$/ : "*",
|
||||||
credentials: true,
|
credentials: true,
|
||||||
}));
|
}));
|
||||||
app.use((req, res, next) => {
|
|
||||||
// res.append('Access-Control-Allow-Origin', ['*']);
|
|
||||||
res.append('Access-Control-Allow-Methods', 'GET,HEAD,PUT,POST,DELETE,OPTIONS');
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
if (inProd) app.set('trust proxy', 1);
|
if (inProd) app.set('trust proxy', 1);
|
||||||
setupSession(app);
|
setupSession(app);
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
|
|
Loading…
Reference in New Issue