Home > Software engineering >  Spring Cloud API gateway not working after deploying it on tomcat
Spring Cloud API gateway not working after deploying it on tomcat

Time:03-10

After deploying the gateway war file on tomcat not able to access it.

application.yml file setup

server:
  port: 9000
  servlet:
    context-path: /gateway

spring:
  cloud:
    gateway:
      routes:
      - id: mysqlservice
        uri:  http://localhost:8080
        predicates:
        - Path= /gateway/mysql/**
        filters:
        - StripPrefix=1     
        
        
      - id: xyzservice
        uri:  http://localhost:8080
        predicates:
         - Path= /gateway/xyz/**    
        filters:
        - StripPrefix=1     
             
        
      - id: lightservice
        uri:  http://localhost:8080
        predicates:
         - Path= /gateway/light/**    
        filters:
        - StripPrefix=1     
        
    

The above configuration works fine when I run it through the normal spring boot JAR file

Ex. http://localhost:9000/gateway/mysql/mysqlapi/test

when it deployed on the tomcat server that time I am not able to access it

Ex. Ex. http://localhost:8080/gateway/mysql/mysqlapi/test

So how can i access it from tomcat server?

CodePudding user response:

You can’t as it is not supported:

Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.

  • Related