> 技术文档 > nginx如何将请求转发到后端服务器,后端服务器又是如何识别请求到其子服务_nginx如何转发到特定的后端服务器

nginx如何将请求转发到后端服务器,后端服务器又是如何识别请求到其子服务_nginx如何转发到特定的后端服务器

nginx中有以下配置:

location /dataplatform/ { proxy_pass http://10.104.0.165:8601/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}location /fusion-fms-costallocat/ { proxy_pass http://10.104.0.165:8601;}

网关的yml文件中配置了routes:

routes: - id: ss-platform-authzth uri: lb://ss-platform-authzth predicates: - Path=/authzth/** filters: - StripPrefix=1 - id: ss-platform-common uri: lb://ss-platform-common predicates: - Path=/common/** filters: - StripPrefix=1

前端传入的路径为http://10.104.0.164:18080/dataplatform/authzth/user/enquiry 此时网关是如何识别转发,请求到对应的子服务中?

1.请求流程概述

  1. 前端请求

    前端发送请求:http://10.104.0.164:18080/dataplatform/authz