Gateway配置文件
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.cxyxiaomo.epp.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class Controller {
|
||||
|
||||
@RequestMapping("/error")
|
||||
public String error() {
|
||||
return "[ERROR] 500 Internal Server Error";
|
||||
}
|
||||
}
|
@@ -15,7 +15,27 @@ spring:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
- id: test
|
||||
uri: lb://microservice-provider-test-8011
|
||||
- id: test1
|
||||
uri: lb://microservice-provider-test
|
||||
predicates:
|
||||
- Path=/test/**
|
||||
- Path=/test/**,/test1/**
|
||||
- Method=GET,POST
|
||||
filters:
|
||||
- StripPrefix=1 # 跳过第一段 /test
|
||||
|
||||
- id: test2
|
||||
uri: lb://microservice-provider-test
|
||||
predicates:
|
||||
- Path=/test2/{routes}
|
||||
filters:
|
||||
- SetPath=/hi/{routes}
|
||||
|
||||
- id: test3
|
||||
uri: lb://microservice-provider-test
|
||||
predicates:
|
||||
- Path=/test3/**
|
||||
filters:
|
||||
- name: RedirectTo
|
||||
args:
|
||||
status: 302
|
||||
url: https://www.baidu.com/?wd=
|
||||
|
Reference in New Issue
Block a user