Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!