相关文章推荐
果断的土豆  ·  WPF开发国产控件库【Newbeecoder ...·  11 月前    · 
有胆有识的牛肉面  ·  vue嵌套路由 && 404重定向 - ...·  1 年前    · 
霸气的充电器  ·  嵌入式数据库 H2 使用总结 - 链滴·  1 年前    · 
还单身的弓箭  ·  性能诊断 - EF Core | ...·  1 年前    · 
小百科  ›  teg nginx根据header分流-腾讯云开发者社区-腾讯云
nginx log header
豪气的移动电源
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;
 
推荐文章
果断的土豆  ·  WPF开发国产控件库【Newbeecoder.UI】主题窗口_newbeecoder.ui官网-CSDN博客
11 月前
有胆有识的牛肉面  ·  vue嵌套路由 && 404重定向 - Wayne-Zhu - 博客园
1 年前
霸气的充电器  ·  嵌入式数据库 H2 使用总结 - 链滴
1 年前
还单身的弓箭  ·  性能诊断 - EF Core | Microsoft Learn
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
小百科 - 百科知识指南
© 2024 ~ 沪ICP备11025650号