spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.54k stars 3.33k forks source link

Not able to access service URL #3516

Open tirtha2u opened 2 months ago

tirtha2u commented 2 months ago

Describe the bug We are using spring cloud mvc 4.1.5. Its working perfectly fine while accessing an external URL. But its returning 500 when accessing service URL

Sample Below is the spring cloud mvc configuration:

spring.cloud.gateway.mvc.routesMap.fcc-xyz.predicates=Path=/api/fcc/xyz/* spring.cloud.gateway.mvc.routesMap.fcc-xyz.uri=${fcc.xyz.application.url} spring.cloud.gateway.mvc.routesMap.fcc-xyz.filters[0].name=RewritePath spring.cloud.gateway.mvc.routesMap.fcc-xyz.filters[0].args[regexp]=/api/fcc/xyz/?(?.) spring.cloud.gateway.mvc.routesMap.fcc-xyz.filters[0].args[replacement]=/api/${segment}

working fine when ${fcc.xyz.application.url} = http://fcc.var.tbe.tbc.tvg.com

but returns 500 when ${fcc.xyz.application.url} = http://fcc.default.svc.cluster.local

spencergibb commented 2 months ago

I don't see how this can have anything to do with gateway specifically. Is there an error or stack trace on the downstream service or gateway?

tirtha2u commented 2 months ago

we are not getting any exception in the log. Below is output from access.log. Could you please help with the steps to print the response body in log.

{"@timestamp":"2024-09-05T14:45:27.521Z","logType":"accessLog","IP":"34.149.131.218","TR":"05/Sep/2024:14:45:27 +0000","RT":"143","TID":"http-nio-8080-exec-1","MT":"GET","URI":"/api/catalog/v2/products","QS":"?siteName=BCOM&filter=PURCHASABLE","HV":"HTTP/1.0","RC":"200","RS":"2942","REF":" https://biz-controls-engine.xyz.com/fcc/products","UA":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","RID":"-","CID":"DiscoveryIndexer","TCIP":"-","AKIP":"-","X_B3_TRACE_ID":"-","Accept":"application/json, text/plain, /","CT":"application/json","x-macys-device":"-","x-bloomingdales-device":"-"}