SpringCloud gateway 过滤
如果需要获取一张图片但服务器没有过滤图片请求地址时,每次请求图片都需要携带token等安全验证密钥,可到nacos配置网关(gateway)的security
配置,可过滤掉你配置的url(可理解为白名单)。找到:
security:
oauth2:
...
ignore:
urls:
在urls
中添加你需要过滤的地址,注意,这里不需要写在网关中配置的前缀,例如:/blog/xxx/xxx
,blog
不需要写,例如需要配置如下路径:
@RestController
@RequestMapping("/articles/")
public class ArticlesController {
/**
* 获取博文图片
*
* @param memberId 用户id
* @param filePath 文件名
*/
@GetMapping("image/{memberId}/{filePath}")
public void reviewImage(@PathVariable(name = "memberId") String memberId,
@PathVariable(name = "filePath") String filePath) {...}
}
需要这么配置:
security:
oauth2:
......
ignore:
urls:
- /articles/image/**/**
如果需要配置多个也和上面配置雷同
security:
oauth2:
......
ignore:
urls:
- /articles/image/**/**
- xxx/xxx/xxx
- /xxx/xx
SpringCloud gateway 过滤的更多相关文章
- SpringCloud Gateway 测试问题解决
本文针对于测试环境SpringCloud Gateway问题解决. 1.背景介绍 本文遇到的问题都是在测试环境真正遇到的问题,不一定试用于所有人,仅做一次记录,便于遇到同样问题的干掉这些问题. 使用版 ...
- spring-cloud-kubernetes与SpringCloud Gateway
本文是<spring-cloud-kubernetes实战系列>的第五篇,主要内容是在kubernetes上部署一个SpringCloud Gateway应用,该应用使用了spring-c ...
- 微服务实战系列(七)-网关springcloud gateway
1. 场景描述 springcloud刚推出的时候用的是netflix全家桶,路由用的zuul,但是据说zull1.0在大数据量访问的时候存在较大性能问题,2.0就没集成到springcloud中了, ...
- springcloud gateway解决跨域问题
/** * 跨域允许 */ @Configuration public class CorsConfig { @Bean public WebFilter corsFilter() { return ...
- SpringCloud Gateway快速入门
SpringCloud Gateway cloud笔记第一部分 cloud笔记第二部分Hystrix 文章目录 SpringCloud Gateway Zull的工作模式与Gateway的对比 Rou ...
- 万字长文:SpringCloud gateway入门学习&实践
官方文档:https://cloud.spring.io/spring-cloud-static/spring-cloud-gateway/2.2.1.RELEASE/reference/html/# ...
- SpringCloud Gateway入门
本文是介绍一下SpringCloud Gateway简单路由转发使用. SpringCloud Gateway简介 SpringCloud是基于Spring Framework 5,Project R ...
- 使用springcloud gateway搭建网关(分流,限流,熔断)
Spring Cloud Gateway Spring Cloud Gateway 是 Spring Cloud 的一个全新项目,该项目是基于 Spring 5.0,Spring Boot 2.0 和 ...
- SpringCloud Gateway(八)
搭建SpringCloud Gateway 创建microservicecloud-springcloud-gateway-9528工程 pom文件 依赖: <dependencies> ...
随机推荐
- JDK 中的栈竟然是这样实现的?
前面的文章<动图演示:手撸堆栈的两种实现方法!>我们用数组和链表来实现了自定义的栈结构,那在 JDK 中官方是如何实现栈的呢?接下来我们一起来看. 这正式开始之前,先给大家再解释一下「堆栈 ...
- JVM笔记五-堆区
JVM笔记五-堆区 在JVM中,堆区是重中之重.通过前面文章的学习,我们知道了,栈区是不会有垃圾回收的,所以,经常说的垃圾回收,其实就是回收的是堆区的数据.在这里,我们将会看到传说中的,新生代.老年代 ...
- cobbler自动化安装centos
转载于:https://www.cnblogs.com/skymydaiji/p/10877533.html 一.cobbler介绍 1.前言 cobbler 是基于 python 语言开发的 pxe ...
- windows server2008 r2激活
KMS激活: 管理员运行cmd 输入以下命令 slmgr /ipk 密钥slmgr /skms zh.us.toslmgr /atoslmgr /xpr 可用密钥如下: KMS Windows Ser ...
- 多测师讲解pthon_re模块_高级讲师肖sir
#import re 一.我们就re模块(也叫正则模块)介绍: 实现一个编译查找,一般在日志处理或者文件处理时用的比较多 正则表达式主要用于模式匹配和替换工作. 预定义字符集匹配: \d: ...
- centos8上安装openresty
一,openresty的官网地址: http://openresty.org/ 说明:说一下openresty的安装方式: 从openresty的安装目录下,可以看到openresty编译安装了自己作 ...
- jdk、eclipse和idea安装
一.jdk下载与环境配置与IDEA 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-213315 ...
- selenium-窗口切换
方法一 # 获取打开的多个窗口句柄 windows = driver.window_handles # 切换到当前最新打开的窗口 driver.switch_to.window(windows[-1] ...
- springboot入门系列(三):SpringBoot教程之RabbitMQ示例
SpringBoot教程之RabbitMQ示例 SpringBoot框架已经提供了RabbitMQ的使用jar包,开发人员在使用RabbitMQ的时候只需要引用jar包简单的配置一下就可以使用Rabb ...
- 10 个 Python 初学者必知编码小技巧
技巧 #1 字符串翻转 a = "codementor">>> print "Reverse is",a[::-1]翻转后的结果为 rotne ...