当前位置:网站首页>Le routage des microservices de la passerelle a échoué au chargement des ressources statiques des microservices
Le routage des microservices de la passerelle a échoué au chargement des ressources statiques des microservices
2022-06-28 02:56:00 【Un rêve nuageux revient à distance】
GatewayLe routage des microservices a échoué à charger les ressources statiques des microservices
1.Gateway
1.1 GatewayIntroduction
- GatewayC'est le microservice Gateway,Fournir un accès uniforme à nos grappes de microservices,Assertion basée sur la correspondance de routage,Accès aux microservices correspondants
2.Gateway Avant et après le succès
2.1 Le scénario de défaillance des ressources statiques réapparaît
- Chemin de ressources statiques introduit sur la page des microservices distants,/css/index.css
<!-- Introduction de l'extérieur Fichiers de style -->
<link rel="stylesheet" type="text/css" href="../static/css/index.css" th:href="@{/css/index.css}">

- Les microservices distants libèrent des ressources statiques,Modifier le profil
spring:
application:
name: ProductPageDemo
# Libérer les ressources statiques
resources:
static-locations: classpath:/static/
- GatewayProfil de la passerelle
server:
port: 80
spring:
application:
name: GatewayDemo
cloud:
gateway:
# Configurer le routage
routes:
- id: ProductPageDemo
uri: http://ProductPageDemo:9100
predicates:
# Assertion,Par /page/ Début de la correspondance
- Path=/page/**
filters:
# Filtre, Les chemins de premier niveau sont supprimés et routés
- StripPrefix=1
- Faire une demande:http://127.0.0.1/page/page/all

2.2 Modification réussie,Chargement réussi
- Parce que ma correspondance de routage nécessite de supprimer le chemin de correspondance de premier niveau ,Donc nous avons besoin de Modifier le chemin de la ressource statique lorsque le micro - service correspondant introduit la ressource statique ,/page/css/index.css
<!-- Introduction de l'extérieur Fichiers de style -->
<link rel="stylesheet" type="text/css" href="../static/css/index.css" th:href="@{/page/css/index.css}">
- Faire une demande:http://127.0.0.1/page/page/all

2.3 Si le chemin de premier niveau n'est pas supprimé , Vous pouvez configurer comme suit
server:
port: 80
spring:
application:
name: GatewayDemo
cloud:
gateway:
# Configurer le routage
routes:
- id: ProductPageDemo
uri: http://ProductPageDemo:9100
predicates:
# Assertion,Par /page/ Début de la correspondance
- Path=/page/**,/css/** # Libérer le chemin de la ressource statique
边栏推荐
- 【模糊神经网络】基于matlab的模糊神经网络仿真
- The first place on the list - the carrying rate of front-end equipment is up to 10%, and the top 10 suppliers of digital key solutions
- Basic flask: template rendering + template filtering + control statement
- [today in history] June 3: Microsoft launched Bing search engine; Larry Roberts starts ARPANET; The father of Visual Basic was born
- Prometheus 2.27.0 new features
- How does win11 close recently opened projects? Win11 method to close recently opened projects
- [today in history] June 19: iPhone 3GS launched; Pascal was born; Anti terrorist elite begins testing
- [today in history] June 16: Oracle Bone Inscriptions was established; Microsoft MSX was born; The inventor of fast Fourier transform was born
- Livedata interview question bank and answers -- 7 consecutive questions for livedata interview~
- win11如何添加打印机和扫描仪?win11添加打印机和扫描仪的设置
猜你喜欢

迪赛智慧数——柱状图(折柱混合图):2021年毕业季租房价格和房租收入比
![[today in history] June 12: the United States entered the era of digital television; Mozilla's original developer was born; 3com merges with American Robotics](/img/91/d7d6137b95f6348f71692164614340.png)
[today in history] June 12: the United States entered the era of digital television; Mozilla's original developer was born; 3com merges with American Robotics

Writing C program with GCC and makefile for the first time

Design e-commerce seckill system

Severe Tire Damage:世界上第一个在互联网上直播的摇滚乐队

Intel Ruixuan A380 graphics card will be launched in China

【二维码图像矫正增强】基于MATLAB的二维码图像矫正增强处理仿真

Online text batch inversion by line tool

What if win11 cannot use dynamic wallpaper? Solution of win11 without dynamic wallpaper
![[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze](/img/eb/147d4aac20639d50b204dcf424c9e2.png)
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
随机推荐
What if win11 can't drag an image to the taskbar software to open it quickly
【历史上的今天】6 月 3 日:微软推出必应搜索引擎;Larry Roberts 启动阿帕网;Visual Basic 之父出生
The horizontal scrolling recycleview displays five and a half in one screen, which is lower than the five average distributions
Online JSON to plaintext tool
【倒立摆控制】基于UKF无迹卡尔曼滤波的倒立摆控制simulink仿真
[plug in -statistical] statistics the number of code lines and related data
How to enable multi language text suggestions? Win11 method to open multilingual text suggestions
Review the submission of small papers for 2022 spring semester courses
Severe Tire Damage:世界上第一个在互联网上直播的摇滚乐队
What if win11 cannot use dynamic wallpaper? Solution of win11 without dynamic wallpaper
为什么大厂压力大,竞争大,还有这么多人热衷于大厂呢?
[today in history] June 3: Microsoft launched Bing search engine; Larry Roberts starts ARPANET; The father of Visual Basic was born
2021年软件测试工具总结——模糊测试工具
You got 8K in the 3-year function test, but were overtaken by the new tester. In fact, you are pretending to work hard
Interview: how do lists duplicate objects according to their attributes?
[today in history] June 7: kubernetes open source version was released; Worldofwarcraft landed in China; Birth of the inventor of packet switching network
Interview: is bitmap pixel memory allocated in heap memory or native
2-5基础配置-Win2003增加攻击面
[block coding] simulation of image block coding based on MATLAB
Get 5 offers after being notified of layoffs