8 months ago
I’d like to know if there’s a way to configure a domain allowlist or restriction so that only requests from specific domains are allowed to access my app over HTTP
Pinned Solution
8 months ago
If you are using Nodejs server for your app , you can use CORS library (npm i cors). its Cross Origin Resource Sharing middleware , which only allow whitelisted domain to access and use you api or app .
configure it in , according your need . for e.g.
import cors from 'cors'
app.use(cors({
origin : ['array of allowed origin'],
credentials: true // true if you are using cookies in your site , by default its false
}))
1 Replies
8 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 8 months ago
8 months ago
If you are using Nodejs server for your app , you can use CORS library (npm i cors). its Cross Origin Resource Sharing middleware , which only allow whitelisted domain to access and use you api or app .
configure it in , according your need . for e.g.
import cors from 'cors'
app.use(cors({
origin : ['array of allowed origin'],
credentials: true // true if you are using cookies in your site , by default its false
}))
Status changed to Solved brody • 8 months ago