Loading…
Test Cross-Origin Resource Sharing (CORS) configuration for any URL. Review the result before reusing it in another workflow.
Use these configurations to enable CORS on your server:
# Nginx CORS Configuration
location /api {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
add_header 'Access-Control-Max-Age' '3600' always;
if ($request_method = 'OPTIONS') {
return 204;
}
}// Express.js CORS Configuration
const cors = require('cors');
app.use(cors({
origin: '*', // Or specify allowed origins
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Authorization', 'Content-Type'],
credentials: true,
maxAge: 3600
}));# Apache CORS Configuration
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "Authorization, Content-Type"
Header set Access-Control-Max-Age "3600"
</IfModule>