提交 fa53a6a3 编写于 作者: Q qinyingjie

fix:zuul设置

上级 d677203c
package com.kwan.springcloud;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;
@Component
public class LogFilter extends ZuulFilter {
@Override
public String filterType() {
return FilterConstants.ROUTE_TYPE;
}
@Override
public int filterOrder() {
return FilterConstants.PRE_DECORATION_FILTER_ORDER;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
return null;
}
}
\ No newline at end of file
......@@ -5,6 +5,16 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
/**
* http:/localhost:8888/portal-service/portal/1
* <p>
* http:/localhost:8888/goods-service/kwanGoodsInfo/1
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/16 10:02
*/
@EnableZuulProxy
@SpringBootApplication
public class ZuulApplication {
......
#端口号
server:
port: 8888
spring:
application:
name: zuul-service #服务名称
#路由规则:
zuul:
sensitiveHeaders: Cookie,Set-Cookie,Authorization
routes:
api-portal:
portal:
path: /portal-service/** #访问路径:http:/localhost:8888/portal-service/portal/1
serviceId: portal-service
api-goods:
path: /goods-service/**
serviceld: goods-service
url: http://localhost:9100/,http://localhost:9200/,http://localhost:9300/
service-id: portal-service
goods:
path: /goods-service/** #http:/localhost:8888/goods-service/kwanGoodsInfo/1
service-id: goods-service
host:
connect-timeout-millis: 5000 #超时时间
prefix: /api #访问路径:http:/localhost:8888/api/portal-service/portal/1 http:/localhost:8888/api/goods-service/kwanGoodsInfo/1
retryable: true
semaphore:
max-semaphores: 100
ribbon-isolation-strategy: thread
# prefix: /api
strip-prefix: false
ignored-services: portal-service #感略某个服务名,禁止通过该服务名访可
# ignored-services: * #禁止通过所有的服务名访间
ignored-patterns: /**/feign/** #不给匹配此棋式的路径进行路由·那么你到时候访间不到
LogFilter:
route:
disable: true #用LogFilter过滤器
# semaphore:
# max-semaphores: 100
# ribbon-isolation-strategy: thread
# strip-prefix: false
#服务提供者
eureka:
client:
service-url:
defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
ribbon:
ConnectTimeout: 250 #连接超时时间(ms),默认值为250ms
ReadTimeout: 2000 #通信超时时间(ms),默认值为2000ms
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册