fix
This commit is contained in:
parent
df307f8db2
commit
0125a91f40
|
@ -17,13 +17,13 @@ const port = process.env.PORT || 4000;
|
|||
|
||||
// Middleware
|
||||
app.use(cors({
|
||||
origin: 'http://localhost:3000', // Разрешаем запросы с фронта
|
||||
origin: 'https://todou.net', // Разрешаем запросы с фронта
|
||||
credentials: true, // Разрешаем куки и авторизацию
|
||||
methods: 'GET,POST,PUT,DELETE,OPTIONS', // Разрешенные методы
|
||||
allowedHeaders: 'Content-Type,Authorization' // Разрешенные заголовки
|
||||
}));
|
||||
app.options('*', (req, res) => {
|
||||
res.header('Access-Control-Allow-Origin', 'http://localhost:3000');
|
||||
res.header('Access-Control-Allow-Origin', 'https://todou.net');
|
||||
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||
res.header('Access-Control-Allow-Credentials', 'true');
|
||||
|
|
Loading…
Reference in New Issue