I write a Spring Boot application with Thymeleaf template engine. Every CSS styles work fine on localhost (embedded tomcat server) but when I deployed my application to an external tomcat server (version: Apache Tomcat/7.0.105) the CSS screws up sometimes.
It's true for every CSS, including my style.css
and bootstrap files.
I tried the import with both href
and th:href
. \
One of my imports:
<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}" href="/css/style.css" />
The funny thing is the error only happens only 1 try from 10. Mozilla Firefox and Google Chrome browsers won't show any error, not even 404. The HTML page also sees css file while inspecting the source of my page in browser.
I store my style.css
here: src/main/resources/static/css/style.css
When I refresh the page, everything works for a few minutes.
Can it be a Tomcat error? I'm using HTTPS. My configuration for my server:
<Connector
protocol="HTTP/1.1"
port="443" maxThreads="300"
scheme="https" secure="true" SSLEnabled="true"
clinetAuth="false" sslProtocol="TLS"
maxHttpHeaderSize="100000"
packetSize="100000"
URIEncoding="UTF-8"
address="example.site.com"
/>
I have found a solution. I just had to update my Tomcat server from Tomcat 7 to Tomcat 9. XAMPP includes Tomcat 7 by default.