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> ...
随机推荐
- Mac 效率工具必备神器 —— Alfred
前言 alfred 这款软件称为「神器」真是当之无愧.今天专门总结一下,作为之前 Mac 配置教程-开发篇 的补充. 需要说明的是,如果你发现我介绍的功能无法使用,则代表需要花钱购买它的 Powerp ...
- C语言中time_t数据类型详细介绍
包含文件:<time.h> #ifndef __TIME_T #define __TIME_T /* 避免重复定义 time_t */ typedef long time_ ...
- API可视化管理平台YApi
Yapi是什么 YApi 是高效.易用.功能强大的 api 管理平台,旨在为开发.产品.测试人员提供更优雅的接口管理服务.可以帮助开发者轻松创建.发布.维护 API,YApi 还为用户提供了优秀的交互 ...
- Git命令diff格式详解
diff是Unix系统的一个很重要的工具程序. 它用来比较两个文本文件的差异,是代码版本管理的基石之一.你在命令行下,输入: $ diff <变动前的文件> <变动后的文件> ...
- day10 Pyhton学习
一.昨日内容回顾 函数: 定义:对功能或者动作的封装 def 函数名(形参): 函数体 函数名(实参) return: 返回,当程序运行到return的时候,终止函数的执行 一个函数一定拥有返回值 ...
- centos8平台使用loginctl管理登录用户与session
一,loginctl的用途: 控制 systemd 登录管理器 管理当前登录的用户和session 说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/a ...
- laravel重写
laravel location / { try_files $uri $uri/ /index.php?$query_string; } ci location / { try_files $uri ...
- 第十六章 IP子网的划分
一.引入 1.根据IP地址的类别进行IP地址分配的方法表现出越来越多的弊端 2.为了解决分类IP地址划分带来的地址浪费,就需要使用子网划分(Subnetting)的方法 3.VLSM和CIDR可以进一 ...
- 第十二章 配置vlan
一.vlan技术简介 1.广播风暴 广播风暴(broadcast storm)简单的讲是指当广播数据充斥网络无法处理,并占用大量网络带宽,导致正常业务不能运行,甚至彻底瘫痪,这就发生了"广播 ...
- 不同系统执行相同shell脚本,出现Syntax error: "(" unexpected错误解决
例如shell脚本在centos系统中能正常执行,而在ubuntu系统中执行会出现类似Syntax error: "(" unexpected的错误,一般这种是因为sh与bash有 ...