Replit ui

Static Files Not Serving on Replit

CSS, JavaScript, and images return 404 or don't load on deployed Replit app. Static resources are missing or misconfigured.

Spring Boot has specific requirements for static file locations and configuration.

Error Messages You Might See

404 Not Found GET /static/css/style.css - 404 Failed to load resource: the server responded with a status of 404
404 Not FoundGET /static/css/style.css - 404Failed to load resource: the server responded with a status of 404

Common Causes

  1. Static files not in correct directory (should be src/main/resources/static)
  2. Spring static resource mapping not configured
  3. Build process excludes static files from JAR
  4. Incorrect static resource prefix in HTML templates
  5. GZIP compression causing browser caching issues

How to Fix It

Place files in src/main/resources/static/css, src/main/resources/static/js. Use Thymeleaf th:href=@{/path/to/file.css} for template links. Ensure build.gradle includes static resources. Disable static resource caching in development with spring.web.resources.cache.period=0. Check Content-Type headers are correct.

Real developers can help you.

ISHANTDEEP SINGH ISHANTDEEP SINGH Senior Software Engineer with 7+ years of experience in React, JavaScript, TypeScript, Next.js, and Node.js. I’ve also worked as a tech lead for startups, owning end-to-end technical execution including architecture, development, scaling, and delivery. I bring a strong mix of hands-on coding, product thinking, and technical leadership, and I’m comfortable building products from scratch as well as improving and scaling existing systems. Nam Tran Nam Tran 10 years as fullstack developer Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround. Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: 🚀 Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. 🏗️ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. ☁️ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. 📈 Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Victor Denisov Victor Denisov Developer

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Where do static files go?

src/main/resources/static/ - Spring Boot serves these automatically at /

How do I reference static files in Thymeleaf?

Use th:href="@{/css/style.css}" instead of /static/css/style.css

Related Replit Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help