This commit is contained in:
itqop 2025-02-11 04:11:58 +03:00
parent df307f8db2
commit 0125a91f40
1 changed files with 2 additions and 2 deletions

View File

@ -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');