Unable to integrate grpc with spring cloud gateway
I am trying to integrate grpc with spring cloud gateway. I want to hit a grpc url and redirect it to the grpc service. My gateway config looks like below
...
..
..
server:
port: 8080
http2:
enabled: true
spring:
application:
name: API Gateway
main:
banner-mode: "off"
web-environment: false
web-application-type: reactive
allow-bean-definition-overriding: true
allow-circular-references: true
cloud:
gateway:
filter:
remove-hop-by-hop:
headers:
- connection
- keep-alive
- transfer-encoding
- proxy-authenticate
- proxy-authorization
- x-application-context
- upgrade
httpclient:
wiretrap: true
ssl:
use-insecure-trust-manager: true
httpserver:
wiretrap: true
routes:
- id: grpc-test
uri: ${service_grpc_url:grpc://grpc-test:50053}
predicates:
- Path= /grpc-api/**
filters:
- RewritePath=/grpc-api(?<segment>/?.*), $\{segment}
..
..
..
On deploying above changes, when i hit the below gateway url
grpc://<api-gateway-host>:8080/grpc-api
It does not redirect to grpc://grpc-test:50053 . I get "service unavailable error".
I am able to reach the grpc service pod directly by hitting grpc://grpc-test:50053, but its not redirecting via api-gateway.
I am using springboot version 3.2.3.
Spring cloud version is 2023.0.0.
I have added below dependencies
implementation (group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-eureka-client')
implementation (group: 'org.springframework.boot', name: 'spring-boot-starter-security')
implementation (group: 'org.springframework.boot', name: 'spring-boot-starter-web')
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-openfeign-core'
Can you please help me out on the issue. Or let me know if have missed out on anything. Do i need to add any grpc specfic dependency?
`Please try Spring Bean Configuration method to configure gateway for a fix for now.
yaml configuration to build a gateway seems to have an issue when binding the values.`
Sorry for the confusion I have made. I am working on the debugging to find the solution for it
Please ignore the answer I have given you. Will get back to you once I found the reasons.
Hi @jivebreaddev , Sure thanks. Kindly let me know if its working fine for you or if anything missed from my side.
Hi @jivebreaddev , is there any update ?
Closing the ticket as raised another one with exact issue https://github.com/spring-cloud/spring-cloud-gateway/issues/3411