Gateway反向代理配置

前言

一般而言,反向代理都是在Nginx中来实现的,其实Gateway也可以作为反向代理服务,不过一般不会这么做,只不过最近的项目,在通过Nginx反向代理之后,iPhone手机访问接口代理地址会异常,安卓手机并不会,奈何技术水平欠缺,数天尝试解决无果后只能退而求其次,通过Gateway来作为网关与代理服务。

配置方式

编辑application.yml文件
yaml 复制代码
# 找到spring.cloud.gateway.routes配置,新增如下配置:
spring:
  cloud:
    gateway:
      routes: #路由配置
        # id,必须唯一
        - id: api
        # 反向代理的服务器地址
        uri: http://localhost:8080/api
        # 匹配规则
        predicates:
          - Path=/api/**
相关推荐
半旧夜夏2 天前
【Gateway】服务调用和网关配置攻略
java·spring boot·spring cloud·gateway
小坏讲微服务2 天前
Nginx集群与SpringCloud Gateway集成Nacos的配置指南
spring boot·nginx·spring cloud·gateway
小坏讲微服务2 天前
使用 Spring Cloud Gateway 实现集群
java·spring boot·分布式·后端·spring cloud·中间件·gateway
没有bug.的程序员2 天前
Spring Cloud Gateway 路由与过滤器机制
java·开发语言·spring boot·spring·gateway
serendipity_hky4 天前
【微服务 - easy视频 | day01】准备工具+gateway网关及路由至内部服务
java·微服务·架构·gateway·springcloud
三口吃掉你7 天前
微服务之网关(Spring Cloud Gateway)
java·网关·微服务·gateway
余衫马8 天前
微服务SpringCloud报错合集
spring boot·gateway
Zz_waiting.8 天前
统一服务入口-Gateway
java·开发语言·gateway
菲兹园长9 天前
微服务组件(E、L、N、O、G)
linux·服务器·gateway
tuokuac12 天前
依赖spring-cloud-starter-gateway与spring-cloud-gateway-dependencies的区别
java·gateway