首页 > 系统相关 >ingress nginx精确匹配

ingress nginx精确匹配

时间:2023-04-20 17:35:06浏览次数:33  
标签:ingress 匹配 third healthcheck factory nginx device backend

如果要精确匹配 /third/factory/device/healthcheck 路径,可以在 rules.http.paths 中直接配置如下:

- path: /third/factory/device/healthcheck
  pathType: Exact
  backend:
    service:
      name: test-blavaplus-api-service
      port:
        number: 80

这里的关键是将 pathType 设置为 Exact,表示只有当请求路径完全等于 /third/factory/device/healthcheck 时才会匹配到对应的 backend。注意,这种方式不支持 query 参数,如果请求携带了参数,则不会匹配成功。


标签:ingress,匹配,third,healthcheck,factory,nginx,device,backend
From: https://blog.51cto.com/yht1990/6210028

相关文章

  • ingress nginx匹配某个固定路径
    这个Ingress资源使用的是NginxIngressController,要将path配置为/third/factory/device/healthcheck的location,可以在annotations中添加如下配置:nginx.ingress.kubernetes.io/rewrite-target:/$2然后在rules.http.paths中使用以下方式配置:-path:/third(/factory/de......
  • Nginx的负载均衡策略
    Nginx的负载均衡策略个人博客地址:https://note.raokun.top拥抱ChatGPT,国内访问网站:https://www.playchat.top共六种:轮询、权重、ip_hash、least_conn、fair、url_hash1、轮询(RoundRobin)负载均衡策略:这是一种基本的负载均衡策略,将请求顺序转发给每个后端服务器,每个后端......
  • xshell断开ssh远程窗口,nginx进程被杀死
    主要原因:是openssh8+以上的版本对安全策略做了修改解决方法:在/usr/lib/systemd/system/[email protected] 配置增加KillMode=process[Unit]Description=OpenSSHper-connectionserverdaemonDocumentation=man:sshd(8)man:sshd_config(5)Wants=sshd-keygen.serviceAfter=sshd-ke......
  • docker安装nginx
    1、搜索nginxdockersearchnginx2、拉取nginx镜像库dockerpullnginx:latest3、查看获取的镜像dockerimages4、启动容器:dockerrun--namenginx-d-p80:80--privileged=true-vD:/nginx/conf/nginx.conf:/etc/nginx/nginx.conf-vD:/nginx/conf/conf.d:/e......
  • Nginx配置proxy_pass
    评:nginx配置proxy_pass,需要注意转发的路径配置1、location/test/{proxy_passhttp://t6:8300;}2、location/test/{proxy_passhttp://t6:8300/;}上面两种配置,区别只在于proxy_pass转发的路径后是否带“/”针对情况2,如果访问url=http://server/test/t......
  • 安装nginx-http-concat和nginx平滑升級
    评:Nginx_concat_module是淘宝开发的基于Nginx减少HTTP请求数量的扩展模块,主要是用于合并减少前端用户Request的HTTP请求的数量下载后把它放在/usr/local/src/文件夹中,到时候nginx需要指定该目录这个需要重新编译nginx,所以顺便把nginx升级了下。下载最新版本Linux代......
  • nginx 安装
    评:nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。正式开始前,编译环境gccg++开发库之类的需要提前装好,这里默认你已经装好。ububtu平台编译环境可以使用以下指令apt-getinstallbuild-essentialapt-getinstalllibtoolcento......
  • nginx location规则以及优先级详解
    nginx配置文件里往往有多个location来区分不同的路径来执行不同的配置 在nginx配置文件中,location主要有这几种形式:1、~#使用波浪符“~”区分大小写正则匹配,如location~/abc{}2、~*#不区分大小写的正则匹配,如location~*/abc{}3、^~#匹配路径的前缀,如......
  • Nacos笔记(五):Nacos集群整合Nginx
    前言Nginx搭建,参考:Linux安装Nginx。1、Nginx配置添加nacos集群,调整端口与服务名,并设置代理,详情如下:   配置详情如下http{includemime.types;default_typeapplication/octet-stream;sendfileon;keepalive_timeout......
  • 【Nginx】Nginx介绍及配置详解
    Nginx是什么Nginx("enginex")是一个高性能的HTTP和反向代理服务器,特点是占有内存少,并发能力强。Nginx官网:http://nginx.org/Nginx安装Nginx官网下载地址:http://nginx.org/en/download.html其中nginx-1.23.4这一列是Linux版本。Windows安装解压Nginx压缩包后,目录如下:启动n......