spring cloud中使用zuul+eureka, zuul路由不到配置了context-path的客户端
client端代码
application.yml
server:
port: 2222
context-path: /client #这里注释掉就正常了
eureka:
client:
service-url:
defaultZone: http://localhost:8888/eureka/
src\main\resources\static\hello.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hello</title>
</head>
<body>
hello!!!!!!!!!!!!!!!!!!!!!!!!!
</body>
</html>
zuul端代码
application.yml
spring.application.name=gateway
server.port=5555
zuul.routes.client.path=/client/**
zuul.routes.client.serviceId=client
eureka.client.serviceUrl.defaultZone=http://localhost:8888/eureka/
访问 localhost:5555/client/hello.html,页面报404找不到.
如果将client端的context-path配置注释掉,页面就能正常访问.
请问在配置context-path的情况下,要怎么修改才能访问到页面
自己解决了
在zuul端加上stripPrefix为false就行了