Static-files are ones that don't get amended during runtime. This could be a HTML file that's served up by a web server.
Questions tagged [static-files]
769 questions
15
votes
2 answers
React (CRA) Service Worker Cache "public" folder
After executing the create-react-app and enabling the service workers in the index.js, all relevant files from the src folder are cached. However some of my resources reside in the public directory. When I run npm run build, the asset-manifest.json…

Constantin Berhard
- 1,271
- 10
- 12
15
votes
1 answer
Serve static files in Flask from private AWS S3 bucket
I am developing a Flask app running on Heroku that allows users to upload images. The app has a page displaying the user's images in a table.
For developing purposes, I am saving the uploaded files to Heroku's ephemeral file system, and everything…

Libra
- 369
- 4
- 15
15
votes
2 answers
Load static files for all templates in django
Is there a way in django to not need the {% load static %} at the top of every template?
This question indicates you can factor out common load tags into settings, but doesn't give the particulars you need in this case.

Zags
- 37,389
- 14
- 105
- 140
15
votes
4 answers
How to intercept 404 using Owin middleware
Background
First let me explain the background. I am working on a project that attempts to marry a backend server that uses Web API configured via OWIN- hosted on IIS now, but potentially other OWIN-supported hosts in the future- to a frontend using…

moribvndvs
- 42,191
- 11
- 135
- 149
14
votes
3 answers
Can I have koa-static serve assets at a custom (e.g., /static/) path?
The docs at https://github.com/koajs/static and my personal experience trying out koa-static lead me to believe that you can only serve files from the root URL of your app.
For example:
app.use(serve('./some/dir/'));
Given the above use of serve,…

orokusaki
- 55,146
- 59
- 179
- 257
14
votes
1 answer
Why is serving static files insecure
This might be a stupid question and have an obvious answer, but I was testing my 404 and 500 error handlers meaning that I had to switch debug to False. I went to Django admin page and noticed that static files are not being served.
I understand…

Mirac7
- 1,566
- 4
- 26
- 44
14
votes
1 answer
`express.static()` keeps routing my files from the route
While working on an express project, I am trying to use an express.Router object to handle my application routes. In my main app file, I have added a static route for all my static files(css, javascript, html).
app.js
var express =…

James Parsons
- 6,097
- 12
- 68
- 108
13
votes
1 answer
How to turn off Rails caching during development
I'm on Rails 5.2.2 and I'm building a web app that uses some static HTML, CSS, and JavaScript that I'm serving from inside of the public directory. Much of the time when I update a file it doesn't update in my browser when I refresh, but if I go…

ceckenrode
- 4,543
- 7
- 28
- 48
13
votes
3 answers
Should I use `src/main/webapp` to serve static content with Spring Boot?
The documentation of Spring Boot states:
Do not use the src/main/webapp directory if your application will be
packaged as a jar.
But surprisingly the Spring Boot Sample for static web files is using the /src/main/webapp directory. And also…

asmaier
- 11,132
- 11
- 76
- 103
13
votes
4 answers
Getting Nginx to serve static files from several sources
I have a Nginx config that works fine and serves static files properly:
location /static/ {
alias /tmp/static/;
expires 30d;
access_log off;
}
But what I want to do now is that if the static file doesn't exist in /tmp/static, Nginx…

Flavien
- 7,497
- 10
- 45
- 52
12
votes
2 answers
Sharing static resources between maven modules
I have a Maven project with a parent-pom project and 3 maven-module projects in it. 2 of the modules are Java-EE web apps that compile into WAR files. 1 of the modules contains common JAVA code which is shared between the 2 other projects. Sharing…

Eric
- 6,563
- 5
- 42
- 66
11
votes
6 answers
React router doesn't work on express server
I am new to react, and I am trying to build a chat-app with it. I used react-router to load different components according to the url. In my react project foler (client/src/index.js), the code is as follows:
import {BrowserRouter as Router, Route}…

Hiber
- 111
- 1
- 1
- 5
11
votes
1 answer
how to get static files in Flask without url_for('static', file_name='xxx')
I don't want use url_for('static', file_name='foo.jpg') to get static file in template.
how to get static file in this way:
thanks


Robin
- 634
- 1
- 7
- 18
10
votes
2 answers
Move Blazor WASM to subdirectory (base directory static files)
I want to make an app where I need static pages on the base domain and my Blazor app on a subdirectory.
Example:
https://example.com is where my static pages should be (like '/features' or '/pricing' or '/faq')
https://example.com/app should be…

Coupz
- 531
- 7
- 11
10
votes
2 answers
Leverage browser caching with web.config in .net?
Some of sites are on shared hosting (Windows 2003 Server), so I have no way to access server configuration.
I read everywhere about leverage browser caching, expecially for static files (jpg, css, js, etc.) but... how to do this in my case?
The…

Ivan
- 2,463
- 6
- 39
- 51