avatar

nk

学习 思考 坚持 平静

  • 首页
  • 关于
Home Nginx配置跨越支持
文章

Nginx配置跨越支持

Posted 2024-03-19 Updated 2024-03- 19
By nk
6~7 min read

Niginx 配置 跨越支持

nginx.conf

nginx 主配置文件

    map $http_origin $allow_origin {
        default "";
        ~^https?://[^/]*\.realme\.net(:[0-9]+)?$ $http_origin;
        ~^https?://[^/]*\.realme\.com(:[0-9]+)?$ $http_origin;
    }

ChatGPT4 对此的解释

image-sadnk.png web.conf

server 块中配置如下

 add_header 'Access-Control-Allow-Origin' $allow_origin always;
 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
 add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
 add_header 'Access-Control-Allow-Credentials' 'true' always;
Linux
Nginx
License:  CC BY 4.0
Share

Further Reading

Mar 19, 2024

Nginx配置跨越支持

Niginx 配置 跨越支持 nginx.conf nginx 主配置文件 map $http_origin $allow_origin { default ""; ~^https?://[^/]*\.realme\.net(:[0-9]+)?$ $http_

Feb 23, 2024

小鸡的自我救赎: Alpine Linux

小鸡的自我救赎: Alpine Linux Alpine Linux 简介 出生时间 2005年8月 听听ChatCPT怎么说 Alpine Linux 是一个面向安全、简洁和资源效率的轻量级 Linux 发行版。它是基于 musl libc 和 busybox 的,这两个组件都是为了提供轻量级和简

OLDER

小鸡的自我救赎: Alpine Linux

NEWER

每日面试题: 2024-3-21

Recently Updated

  • 拥抱云原生:Dockerfile 的多阶段构建
  • 拥抱云原生:Dockerfile
  • 拥抱云原生:Docker文件系统
  • 拥抱云原生:Docker 指令小析
  • 拥抱云原生:起始

Trending Tags

Nginx 工作报告 云计算 云原生 Alpine Linux Docker Spring Linux 面试智慧

Contents

©2025 nk. Some rights reserved.

Using the Halo theme Chirpy