当前位置:网站首页>Gateway microservice routing failed to load microservice static resources
Gateway microservice routing failed to load microservice static resources
2022-06-28 02:57:00 【Cloud dream returns to remote】
Gateway Microservice routing causes microservice static resources to fail to load
1.Gateway
1.1 Gateway Introduce
- Gateway Gateway microservices , Provide a unified entrance for our micro service clusters , Assert based on route matching , Access the corresponding microservices
2.Gateway Before and after success
2.1 The static resource failure scenario reappears
- The static resource path introduced on the remote microservice page ,/css/index.css
<!-- Introduce the outside The style file -->
<link rel="stylesheet" type="text/css" href="../static/css/index.css" th:href="@{/css/index.css}">
- Remote microservices release static resources , Modify the configuration file
spring:
application:
name: ProductPageDemo
# Release static resources
resources:
static-locations: classpath:/static/
- Gateway Gateway profile
server:
port: 80
spring:
application:
name: GatewayDemo
cloud:
gateway:
# Configure the routing
routes:
- id: ProductPageDemo
uri: http://ProductPageDemo:9100
predicates:
# Assertion , With /page/ Match at the beginning
- Path=/page/**
filters:
# filter , The first level path will be removed and then routed
- StripPrefix=1
- For the request :http://127.0.0.1/page/page/all
2.2 Modification successful , Successfully loaded
- Because my route matching needs to remove the first level matching path , So we need to be able to Modify the static resource path when the corresponding micro service introduces static resources ,/page/css/index.css
<!-- Introduce the outside The style file -->
<link rel="stylesheet" type="text/css" href="../static/css/index.css" th:href="@{/page/css/index.css}">
- For the request :http://127.0.0.1/page/page/all
2.3 If the first level path is not removed , You can configure as follows
server:
port: 80
spring:
application:
name: GatewayDemo
cloud:
gateway:
# Configure the routing
routes:
- id: ProductPageDemo
uri: http://ProductPageDemo:9100
predicates:
# Assertion , With /page/ Match at the beginning
- Path=/page/**,/css/** # Release static resource path
边栏推荐
- Online text batch inversion by line tool
- 榜单首发——前装搭载率站上10%大关,数字钥匙方案供应商TOP10
- Get 5 offers after being notified of layoffs
- The graduation season is coming, and the number of college graduates in 2022 has exceeded 10 million for the first time
- CRF+BiLSTM代码分步骤解读
- Win11 cannot create a new text document? Solution to win11 right click failure to create a new text document
- Interview: is bitmap pixel memory allocated in heap memory or native
- Win11不能拖拽图片到任务栏软件上快速打开怎么办
- Usage differences between isempty and isblank
- Win11如何关闭最近打开项目?Win11关闭最近打开项目的方法
猜你喜欢
Interpretation of bilstm-crf in NER forward_ algorithm
[cloud native] - docker installation and deployment of distributed database oceanbase
3年功能测试拿8K,被刚来的测试员反超,其实你在假装努力
NER中BiLSTM-CRF解读Forward_algorithm
Mixed programming of C language and assembly language in stm32
Character interception triplets of data warehouse: substrb, substr, substring
Différences d'utilisation entre IsEmpty et isblank
Win11新建不了文本文档?Win11右键无法新建文本文档的解决方法
为什么大厂压力大,竞争大,还有这么多人热衷于大厂呢?
[today in history] June 15: the first mobile phone virus; AI master simahe was born; Chromebook launch
随机推荐
[elevator control system] design of elevator control system based on VHDL language and state machine, using state machine
[2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB
Flutter 使用 CustomPaint 绘制基本图形
StaticLayout的使用详解
【倒立摆控制】基于UKF无迹卡尔曼滤波的倒立摆控制simulink仿真
[kotlin] basic introduction and understanding of its syntax in Android official documents
"Everyday Mathematics" serial 53: February 21
Cloud native (30) | kubernetes' app store Helm
Arduino esp8266 web LED control
Initial linear regression
Win11 ne peut pas faire glisser l'image sur le logiciel de la barre des tâches
Exploration on the construction path of real-time digital warehouse integrating digital intelligence learning and streaming batch
math_ (function & sequence) meaning of limit & misunderstanding and symbol sorting / neighborhood & de centring neighborhood & neighborhood radius
[today in history] June 2: Apple launched swift programming language; China Telecom acquires China Unicom C network; OS X Yosemite release
MFC常用 当前路径
Review the submission of small papers for 2022 spring semester courses
be fond of the new and tired of the old? Why do it companies prefer to spend 20K on recruiting rather than raise salaries to retain old employees
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
2021年软件测试工具总结——模糊测试工具
目标检测|SSD原理与实现