Closed muradhajiyev closed 4 years ago
Hey @muradhajiyev,
This looks like a routing problem within the gateway.
Check your application.yml
(or application.properties)
in the gateway project.
spring.cloud.gateway.routes:
- id: product-composite
uri: lb://product-composite
predicates:
- Path=/product-composite/{segment}
- id: product-composite-swagger-ui
uri: lb://product-composite
predicates:
- Path=/swagger-ui.html
- id: product-composite-swagger-v2
uri: lb://product-composite
predicates:
- Path=/v2/**
- id: product-composite-swagger-resources
uri: lb://product-composite
predicates:
- Path=/swagger-resources/**
- id: product-composite-swagger-jars
uri: lb://product-composite
predicates:
- Path=/webjars/**
...
The reason I added the extra routers is that after swagger.html
loads it will ask for various other resources like .js, .css ...etc; Those need to be routed as well.
There most likely is a way of solving this in a less verbose approach. Maybe @magnus-larsson has an input here.
Hey @muradhajiyev,
This looks like a routing problem within the gateway. Check your
application.yml
(orapplication.properties)
in the gateway project.spring.cloud.gateway.routes: - id: product-composite uri: lb://product-composite predicates: - Path=/product-composite/{segment} - id: product-composite-swagger-ui uri: lb://product-composite predicates: - Path=/swagger-ui.html - id: product-composite-swagger-v2 uri: lb://product-composite predicates: - Path=/v2/** - id: product-composite-swagger-resources uri: lb://product-composite predicates: - Path=/swagger-resources/** - id: product-composite-swagger-jars uri: lb://product-composite predicates: - Path=/webjars/** ...
The reason I added the extra routers is that after
swagger.html
loads it will ask for various other resources like .js, .css ...etc; Those need to be routed as well.There most likely is a way of solving this in a less verbose approach. Maybe @magnus-larsson has an input here.
@mariusmagureanu Thank you. The author already uses openapi 3.0.
id: swagger uri: lb://product-composite predicates:
id: product-composite-swagger-v2 uri: lb://product-composite predicates:
id: product-composite-swagger-resources uri: lb://product-composite predicates:
it helped.
First of all, thank you for the useful book.
I faced an issue in Chapter 10 and afterward. So, After implementing gateway, while trying to access swagger, it says 404. Could someone help me to solve this issue? The URL I try to access for swagger is below:
http://localhost:8080/product-composite/swagger-ui/index.html or http://localhost:8080/product-composite/swagger-ui.html