记录 - nginx反代后端常用配置

location ^~ / {
    proxy_pass http://localhost:3336; 
    
    # 基础头部设置
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-Proto $scheme; 
    
    # 连接相关头部
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    proxy_http_version 1.1; 
    
    # 缓存和安全头部
    add_header X-Cache $upstream_cache_status; 
    add_header Strict-Transport-Security "max-age=31536000"; 
    proxy_ssl_server_name off; 
    proxy_ssl_name $proxy_host; 

    # 如果支持h3
    add_header Alt-Svc 'h3=":443"; ma=2592000'; 
}