Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

361
Visualizações
How to make tomcat server deliver javascript/css from spring boot application on first page load?

I have a small Spring Boot Web Application which is running on a tomcat server. It consists only of a single html page. This page loads some css files in the head-section and two js files at the end of the body.

When I load the page in Chrome (same situation in Firefox etc.) with an empty browser cache the html get loaded correctly but the css/js files get a 404 (see first picture). The result is that the page is completly unstyled and without any functions. When I then hit F5 the page loads completly and looks and works as expected (see picture 2). This behaviour is reproducible! If I ever again load the page without deleting the jsessionid-cookie the page always loads everything.

CSS/JS is not loaded

Page loads completly

The problem seems to be that there is no jsessionid-cookie present in the very first load of the html page. The HTTP-Response to that very first HTTP-request delivers a jsessionid-cookie which the other HTTP-request use (as you can see in the first picture). But the session seems not to be recognized in the servlet.

Every page load later on has a cookie present in the first HTTP-request. Even if the jsessionid-cookie is invalid the page loads completly.

I does not matter if the connection is to localhost or a remote-server, if it's HTTP or HTTPS, if it's HTTP 1.1 or HTTP 2.

Does someone know if this is a configuration problem? Or something special to spring-boot or tomcat?

Ideas appreciated.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda