Код: Выделить всё
spring:
cloud:
gateway:
mvc:
routes:
- id: api-routes
uri: http://localhost:8081
predicates:
- Path=/api/v1.0/access-token,/api/v1.0/inquiry
- Method=POST,OPTIONS
filters:
- name: DedupeResponseHeader # Remove duplicate headers
args:
name: Access-Control-Allow-Credentials Access-Control-Allow-Origin
- name: StripPrefix # Remove the prefix '/my-gateway' from the request
args:
parts: 1
- name: PrefixPath # Add the prefix '/api-server' to the request
args:
prefix: /api-server
metadata:
cors:
allowedOrigins: '*'
allowedMethods: '*'
allowedHeaders: '*'
allowCredentials: true
maxAge: 30
Код: Выделить всё
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("**/**")
.allowedOrigins("*")
.allowedMethods("*")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(3600);
}
}
[img]https://i. sstatic.net/pLllMOfg.png[/img]
Любая помощь очень ценится.
Подробнее здесь: https://stackoverflow.com/questions/787 ... ot-working
Мобильная версия