相关文章推荐
闯红灯的毛巾  ·  如何自行开发代码访问阿里语音服务_智能语音交 ...·  2 月前    · 
苦闷的手术刀  ·  How to append rows ...·  1 月前    · 
绅士的书包  ·  403 Forbidden - HTTP ...·  1 月前    · 
性感的橙子  ·  access ...·  7 月前    · 
苦闷的围巾  ·  PostgreSQL的模式、表、空间、用户间 ...·  1 年前    · 
老实的钥匙扣  ·  exec | Microsoft Learn·  1 年前    · 
温柔的汉堡包  ·  C语言每隔1s输出一个数据,同时还要处理输入 ...·  1 年前    · 
Code  ›  teg nginx根据header分流开发者社区
nginx log header
https://cloud.tencent.com/developer/article/1508106
豪气的移动电源
1 年前
作者头像
葫芦
0 篇文章

teg nginx根据header分流

前往专栏
腾讯云
开发者社区
文档 意见反馈 控制台
首页
学习
活动
专区
工具
TVP
文章/答案/技术大牛
发布
首页
学习
活动
专区
工具
TVP
返回腾讯云官网
社区首页 > 专栏 > 葫芦 > teg nginx根据header分流

teg nginx根据header分流

作者头像
葫芦
发布 于 2019-09-18 10:26:07
1.9K 0
发布 于 2019-09-18 10:26:07
举报

nginx根据header分流

不同header头分发到不同节点

同一域名路径根据不同header头分发到不同节点,以此来做灰度发布。 主要配置 通过 http_newversion 判断版本,转发至不同upstream。

test.bthlt.com.conf

server {
    listen       80;
    server_name  test.bthlt.com;
    underscores_in_headers on;
    access_log  /data/log/elk/test.bthlt.com.access.log weimob_json;
    error_log  /data/log/nginx/test.bthlt.com.error.log;
    location / {
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X_CUSTOM_HEADER $http_host;
    if ($http_newversion = '1'){
         proxy_pass http://hl_v1_node;
        if ($http_newversion = '2'){
         proxy_pass http://hl_v2_node;
}

upstream

upstream hl_v1_node  {
    server 10.1.1.1:8080 id=102 weight=10;
    keepalive 100;
    check interval=3000 rise=2 fall=5 timeout=1000 type=tcp;
 
推荐文章
闯红灯的毛巾  ·  如何自行开发代码访问阿里语音服务_智能语音交互(ISI)-阿里云帮助中心
2 月前
苦闷的手术刀  ·  How to append rows data on grid view to header on end event page when export data to pdf? - Microsof
1 月前
绅士的书包  ·  403 Forbidden - HTTP | MDN
1 月前
性感的橙子  ·  access vba使用sql查询附件字段内指定附件图片文件 - CSDN文库
7 月前
苦闷的围巾  ·  PostgreSQL的模式、表、空间、用户间的关系 - 掘金
1 年前
老实的钥匙扣  ·  exec | Microsoft Learn
1 年前
温柔的汉堡包  ·  C语言每隔1s输出一个数据,同时还要处理输入和输出? - 知乎
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号