Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #5631

reverse-proxy

Skill này làm gì

Reverse proxy giúp điều hướng lưu lượng Internet đến các dịch vụ của bạn. Nó cũng có thể bảo vệ dịch vụ bằng cách quản lý chứng chỉ bảo mật (SSL) và kiểm soát ai được truy cập vào đâu.

Khi nào nên dùng

  • ✓Khi bạn có nhiều dịch vụ và muốn truy cập tất cả qua một địa chỉ duy nhất.
  • ✓Khi bạn muốn thêm một lớp bảo mật, như chứng chỉ SSL, trước khi lưu lượng đến các dịch vụ.
  • ✓Khi bạn muốn kiểm soát số lượt truy cập một dịch vụ nhận được, tránh tình trạng quá tải.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/reverse-proxy/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/reverse-proxy/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thiết lập reverse proxy để website 'my-app.com' chuyển lưu lượng đến dịch vụ đang chạy ở cổng 3000.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Reverse proxy đứng trước các dịch vụ của bạn. Khi có người truy cập vào địa chỉ của bạn, proxy quyết định gửi yêu cầu đến dịch vụ nào. Nó cũng có thể xử lý và cài đặt các chứng chỉ bảo mật.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Reverse Proxy

Configure reverse proxies to route traffic, terminate TLS, enforce rate limits, and serve as the gateway between clients and backend services.

When to Use

  • Routing traffic from a public domain to one or more backend services.
  • Terminating TLS at the edge and forwarding plain HTTP to backends.
  • Adding rate limiting, CORS, security headers, and access control.
  • Consolidating multiple services under a single domain with path-based routing.
  • Handling WebSocket upgrades, gRPC proxying, or HTTP/2 passthrough.

Prerequisites

  • Backend service(s) running on known host:port.
  • TLS certificate (Let's Encrypt, ACM, or self-signed for development).
  • nginx 1.25+ or Traefik 3.x installed.
  • DNS record pointing the domain to the proxy server.

nginx Reverse Proxy

Basic HTTPS Proxy with Redirect

# /etc/nginx/sites-available/app.example.com
server {
    listen 80;
    server_name app.example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name app.example.com;

    # TLS configuration
    ssl_certificate     /etc/letsencrypt/live/app.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
    ssl_protocols       TLSv1.2 TLSv1.3;
    ssl_ciphers         ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    # Security headers
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
    add_header X-Frame-Options DENY always;
    add_header X-Content-Type-Options nosniff always;
    add_header Referrer-Policy strict-origin-when-cross-origin always;

    # Proxy to backend
    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Timeouts
        proxy_connect_timeout 5s;
        proxy_read_timeout 60s;
        proxy_send_timeout 60s;

        # Buffering
        proxy_buffering on;
        proxy_buffer_size 4k;
        proxy_buffers 8 4k;
    }
}

Path-Based Routing to Multiple Services

server {
    listen 443 ssl http2;
    server_name app.example.com;

    ssl_certificate     /etc/letsencrypt/live/app.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;

    # Frontend SPA
    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
    }

    # API backend
    location /api/ {
        proxy_pass http://127.0.0.1:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_read_timeout 120s;
    }

    # WebSocket endpoint
    location /ws/ {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 86400s;  # 24h for long-lived connections
    }

    # Static assets with caching
    location /static/ {
        alias /var/www/static/;
        expires 30d;
        add_header Cache-Control "public, immutable";
    }
}

Rate Limiting

# Define rate limit zones in http block
http {
    # 10 requests/second per IP
    limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;

    # 1 request/second for login
    limit_req_zone $binary_remote_addr zone=login_limit:10m rate=1r/s;

    # Connection limit per IP
    limit_conn_zone $binary_remote_addr zone=conn_limit:10m;
}

server {
    listen 443 ssl http2;
    server_name app.example.com;

    # Apply rate limit to API
    location /api/ {
        limit_req zone=api_limit burst=20 nodelay;
        limit_req_status 429;
        proxy_pass http://127.0.0.1:8080;
    }

    # Strict rate limit on auth endpoints
    location /api/auth/ {
        limit_req zone=login_limit burst=5;
        limit_req_status 429;
        proxy_pass http://127.0.0.1:8080;
    }

    # Connection limit
    location / {
        limit_conn conn_limit 100;
        proxy_pass http://127.0.0.1:3000;
    }
}

Gzip and Brotli Compression

http {
    gzip on;

…
Câu hỏi thường gặp

SSL/TLS là gì?

Đây là công nghệ mã hóa đường truyền giữa người dùng và máy chủ, giúp dữ liệu trao đổi được an toàn và riêng tư. Reverse proxy quản lý việc này.

“Route traffic” nghĩa là gì?

Nghĩa là chuyển các yêu cầu đến đúng dịch vụ dựa trên các quy tắc như địa chỉ truy cập hoặc loại yêu cầu.

Tôi có cần cài Nginx hoặc Traefik không?

Có, reverse proxy cần phần mềm như Nginx hoặc Traefik được cài đặt và cấu hình trên máy chủ để hoạt động.

Chi tiết

Mô tả gốc của tác giả

Configure nginx and Traefik as reverse proxies. Implement SSL termination and routing. Use when setting up application gateways.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5631
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự