cors
This commit is contained in:
parent
37b104efd8
commit
df71931aa4
1 changed files with 10 additions and 1 deletions
|
|
@ -77,7 +77,16 @@ const upload = multer({
|
|||
pool.connect()
|
||||
.then(() => console.log('Connected to PostgreSQL database'))
|
||||
.catch(err => console.error('Database connection error:', err));
|
||||
|
||||
|
||||
// Handle SSL proxy headers
|
||||
app.use((req, res, next) => {
|
||||
// Trust X-Forwarded-Proto header from Cloudflare
|
||||
if (req.headers['x-forwarded-proto'] === 'https') {
|
||||
req.secure = true;
|
||||
}
|
||||
next();
|
||||
});
|
||||
app.set('trust proxy', true);
|
||||
// Middleware
|
||||
app.use(cors({
|
||||
origin: '*',
|
||||
|
|
|
|||
Loading…
Reference in a new issue