Skip to content

Commit f552d55

Browse files
committed
Cors test 4
1 parent 42d676a commit f552d55

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

backend/server.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ const rateLimit = require("express-rate-limit")
99

1010
const app = express()
1111

12+
const corsOptions = {
13+
headers: [
14+
{ key: "Access-Control-Allow-Credentials", value: "true" },
15+
{ key: "Access-Control-Allow-Origin", value: "*" },
16+
],
17+
origin: "*",
18+
optionsSuccessStatus: 200,
19+
}
20+
1221
app.use(morgan("common"))
1322
// app.use(helmet());
14-
app.use(cors())
23+
app.use(cors(corsOptions))
1524
app.use(express.json())
1625
app.use(express.static(path.join(__dirname + "/../frontend/build")))
1726

vercel.json

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
{
1212
"source": "/(.*)",
1313
"headers": [{ "key": "Access-Control-Allow-Origin", "value": "*" }]
14-
},
15-
{
16-
"source": "/vercel_app_domain_name/(.*)",
17-
"headers": [{ "key": "Access-Control-Allow-Origin", "value": "*" }]
1814
}
1915
]
2016
}

0 commit comments

Comments
 (0)