Trình tạo chính sách CORS

Tạo tiêu đề cấu hình CORS

CORS Policy Generator

Configure Cross-Origin Resource Sharing and generate header values plus example Express/Nginx configs.

Access-Control-* Headers
Access-Control-Allow-Origin: https://example.com
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Max-Age: 86400
Express.js Config
const express = require('express');
const cors = require('cors');
const app = express();

app.use(cors({
  origin: 'https://example.com',
  methods: ['GET', 'POST'],
  allowedHeaders: ['Content-Type', 'Authorization'],
  credentials: false,
  maxAge: 86400
});
Nginx Config
# Nginx CORS configuration
location / {
  add_header 'Access-Control-Allow-Origin' 'https://example.com' always;
  add_header 'Access-Control-Allow-Methods' 'GET, POST' always;
  add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always;
  
  
  add_header 'Access-Control-Max-Age' '86400' always;

  if ($request_method = 'OPTIONS') {
    return 204;
  }
}

Trình tạo chính sách CORS là một công cụ web miễn phí. Tạo tiêu đề cấu hình CORS Không tải xuống, hoạt động trên mọi thiết bị, dữ liệu của bạn không bao giờ rời khỏi trình duyệt của bạn.

Use Cases

Sử dụng hàng ngày

Công việc chuyên môn

Tham khảo nhanh

Mục đích giáo dục

Tool Information

Category
🔧 Security & Privacy
Type
Processed in browser
Tags

📤 Share This Tool

Trình tạo chính sách CORS - Gratis Online | NavajaSuiza Digital