Search code examples
spring-bootkotlinhttp-status-code-404

Spring Boot application in Kotlin starts to answer 404 after some time


I'm having this problem with a new Spring Boot service, written in Kotlin, where I start to get 404 for any REST requests after some random time (When I deploy the service, instead, everything works fine, with the same REST APIs). In addition, I've also other services, written in Java, that are running without any problem.

Just to specify:

  • all the components are well defined in the application;
  • I've moved logging filters and some authorization logic in libraries also used in the java services (services that are running perfectly);
  • I am not able to reproduce locally, it happens after some time only in staging and prod envs.

Then I've noticed a really strange thing:

  • when running a public request (so that I skip all the auth logic checks) the logger prints the response status as 200 -> but then the final answer that the client gets is 404.

Do you have any idea or tip?

Thanks


Solution

  • Problem fixed! It was a mistake in the middleware, there were two service without the correct routing setup -> traefik was not able to redirect the traffic in the right way