
gateway
文章平均质量分 58
木鱼-
过一天就要进步一点,而且不知道也会更多,还有每天都会忘记一点。所以每天还得做功课
展开
-
Spring WebFlux下CORS WebFilter与SecurityWebFilterChain的配置
需求:前端VUE项目需要在HTTP header添加JWT token发送到Spring后端认证。尝试:使用Spring官方的配置@Configuration@EnableWebFluxpublic class WebConfig implements WebFluxConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMappin转载 2021-11-02 17:55:10 · 3660 阅读 · 1 评论 -
gateway网关请求服务的400错误
gateway网关请求服务job-service时,前端的请求结果如下:Request URL:http://127.0.0.1:8080/job/task/xxx.do?pageindex=1&pagesize=10&taskType=&taskName=&taskState=Request Method: GETStatus Code: 400Remote Address: 127.0.0.1:8080Referrer Policy: strict-o.原创 2021-06-24 18:35:42 · 4462 阅读 · 0 评论 -
gateway动态路由nacos配置中心路由配置spring-cloud-alibaba 解决nacos config配置不生效问题
目前升级使用以下的版本。apply plugin: 'io.spring.dependency-management'dependencyManagement { imports { mavenBom 'org.springframework.boot:spring-boot-dependencies:2.3.8.RELEASE' mavenBom 'org.springframework.cloud:spring-cloud-dependencies:H...原创 2021-06-28 10:13:56 · 3258 阅读 · 1 评论 -
Spring cloud gateway 路由刷新无效的问题
Spring cloud gateway 路由刷新无效的问题因为配置了这个,导致路由刷新失效了原创 2021-05-26 16:13:04 · 1402 阅读 · 0 评论 -
gateway网关的DataBufferLimitException报错问题
请求返回数据据内容长度(默认256K)支持做限制用的,如果请求体内容超过这个长度就抛异常查看源码发现,设置spring.codec.max-in-memory-size=-1,就不去做校验了具体方法所在:org.springframework.core.io.buffer.DataBufferUtils#join(org.reactivestreams.Publisher<?extendsorg.springframework.core.io.buffer.DataBuffer&g..原创 2021-03-05 16:52:51 · 2172 阅读 · 0 评论 -
Spring Cloud Gateway来开发了API网关,REST API接口返回JSON超过256K时报错问题
查看Spring Core 5.1.14.RELEASE的AbstractDataBufferDecoder类,发现以下说明:设置maxInMemorySize值的说明原因:/***配置可随时缓冲的字节数限制*需要聚合输入流。这可能是*解码为单个{@code DataBuffer},*{@链接java.nio.ByteBuffer文件ByteBuffer},{@code byte[]},*{@链接org.springframework.core.io.资源资源}、{@code S原创 2021-02-24 16:40:28 · 2226 阅读 · 1 评论 -
RedisTemplate执行lua脚本在Redis集群模式下报错EvalSha is not supported in cluster environment.
异常信息:复制org.springframework.dao.InvalidDataAccessApiUsageException: EvalSha is not supported in cluster environment. at org.springframework.data.redis.connection.jedis.JedisClusterScriptingCommands.evalSha(JedisClusterScriptingCommands.java:83) ~[spring转载 2021-01-14 13:53:45 · 1609 阅读 · 2 评论 -
SpringCloud gateway (史上最全)
1.1SpringCloud Gateway 简介SpringCloud Gateway 是 Spring Cloud 的一个全新项目,该项目是基于 Spring 5.0,Spring Boot 2.0 和 Project Reactor 等技术开发的网关,它旨在为微服务架构提供一种简单有效的统一的 API 路由管理方式。SpringCloud Gateway 作为 Spring Cloud 生态系统中的网关,目标是替代 Zuul,在Spring Cloud 2.0以上版本中,没有对新版本的Zuu.转载 2020-12-23 10:58:06 · 430 阅读 · 0 评论 -
Spring Cloud Gateway WebFilter工厂 | Baeldung
Spring Cloud Gateway是微服务中经常使用的智能代理服务。它透明地将请求集中在单个入口点中,并将其路由到适当的服务。它的一个最有趣的特点是概念过滤器(网页过滤或GatewayFilter)。WebFilter与谓词工厂一起,包含完整的路由机制。Spring Cloud Gateway提供了许多内置的WebFilter工厂,这些工厂允许在到达代理服务之前与HTTP请求进行交互,并在将结果传递给客户端之前与HTTP响应进行交互。也可以实现自定义过滤器。在本教程中,我们将重点介绍项目中包含转载 2020-10-26 13:59:19 · 1804 阅读 · 0 评论 -
Spring Cloud 路由网关(Gateway:异步,WebFlux) nacos配置
Zuul支持参考 Sentinel 网关限流(同步并阻塞)若想跟 Sentinel Starter 配合使用,需要加上 spring-cloud-alibaba-sentinel-gateway 依赖,同时需要添加 spring-cloud-starter-netflix-zuul 依赖来让 spring-cloud-alibaba-sentinel-gateway 模块里的 Zuul 自动化配置类生效:<dependency> <groupId>com..转载 2020-10-26 11:21:30 · 4104 阅读 · 0 评论 -
Spring-Cloud-Gateway之请求处理流程
Spring-Cloud-Gateway 初始化,路由模型,以及路由加载等源码在上几篇学习文档中已经描述,接下来来看Spring-Cloud-Gateway是怎么通过这些来对我们的请求进行路由处理的Spring-Cloud-Gateway整体流程图imageDispatcherHandler:所有请求的调度器,负载请求分发 RoutePredicateHandlerMapping:路由谓语匹配器,用于路由的查找,以及找到路由后返回对应的WebHandler,DispatcherHan转载 2020-10-26 11:17:18 · 1782 阅读 · 0 评论 -
Spring Cloud-网关 Spring-Cloud-Gateway,eureka配置
简介Spring Cloud Gateway 是 Spring Cloud 的一个全新项目,该项目是基于 Spring 5.0,Spring Boot 2.0 和 Project Reactor 等技术开发的网关,它旨在为微服务架构提供一种简单有效的统一的 API 路由管理方式。Spring Cloud Gateway 作为 Spring Cloud 生态系统中的网关,目标是替代 Netflix Zuul,其不仅提供统一的路由方式,并且基于 Filter 链的方式提供了网关基本的功能,例如:安全,监转载 2020-10-23 11:14:19 · 3149 阅读 · 0 评论