static-files

Defining CharSet for static HTML files

半腔热情 提交于 2019-12-05 15:43:35
I just tried several times to define character set for static files served from Google App Engine and failed miserably. File does contain correct meta-equiv tag in header section of file: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> But it's not being passed as header, browser needs to pick it up from the actual document. Naturally if I use script (or Python Google App Engine program) then I can get it delivered correctly as response header. Content-Type: text/html; charset=UTF-8 I tried to add to app.yaml file rows: - url: / static_files: root/create.html upload: root

ReactJS: How to prevent browser from caching static files?

亡梦爱人 提交于 2019-12-05 14:36:39
I'm working on my project using ReactJS and I use create-react-app to create my app. After building project, I use my server to serve the build folder. And when I update my app, the browser of user still uses the old version of my app because it caches the static files (js, css). So is there any way to prevent browser from caching static files ? Thank you ! TLDR: You will want to send caching instructions via HTTP headers. The Cache-Control header has several directives to control cache behavior, expiration, and validation. Cache Behavior: https://developer.mozilla.org/en-US/docs/Web/HTTP

Configure IIS7 to server static content through ASP.NET Runtime

余生颓废 提交于 2019-12-05 14:22:02
I searched high an low and still cannot find a definite answer. How do I configure IIS 7.0 or a Web Application in IIS so that ASP.NET Runtime will handle all requests -- including ones to static files like *.js , *.gif , etc? What I'm trying to do is as follows. We have kind of SaaSy site, which we can "brand" for every customer. "Branding" means developing a custom master page and using a bunch of *.css and other images. Quite naturally, I'm using VirtualPathProvider , which operates like this: public override System.Web.Hosting.VirtualFile GetFile(string virtualPath) { if(PhysicalFileExists

Check for a static file during Application_BeginRequest?

放肆的年华 提交于 2019-12-05 06:12:19
I have a Global.asx file that needs to do custom authentication, auditing and profiling stuff. This is needed because it supports a SAML based SSO system and needs to override the normal .Net authentication (which doesn't support either SAML or mixed authentication) I don't want to fire it for static files, such as .js , .css , .png , etc In Cassini/WebDev and IIS7 it does. What I want to have is some simple check, like a this.Request.IsStaticFile (which doesn't exist, unfortunately) to identify the static files. I realise that this would be fairly simple to write, but it feels like something

Subdirectories not being served with express.static in heroku

一笑奈何 提交于 2019-12-05 02:52:58
问题 I'm seeing some really odd behavior where some of my files are correctly being returned by my express/node server (using express.static() ), but not files within subdirectories. The frustrating thing is that it works fine using node or foreman locally, it just won't work on heroku. This gist has the main files at play here, and my app structure looks like this: -app - index.html - img/ - base.png - sub/ - sub.png - scripts - base.js - sub/ - sub.js - css - base.css - sub/ - sub.css - server -

What is the best way to optimize a Windows Server 2008 box running IIS7 to serve only static files?

旧时模样 提交于 2019-12-05 02:50:14
问题 I would like to have our web applications pull static content (css, js, images) from a static file server running Windows Server 2008 and IIS7. What sort of optimizations would you make to the server for this single purpose? (Machine.config changes? Web.config changes? Special IIS7 setup or modules? What?) 回答1: Some advices: Enable gzip compression: http://blogs.msdn.com/vivekkum/archive/2009/02/18/http-compression-in-iis-6-and-iis-7-using-service-account.aspx Set Cache-Control: max-age to

Sharing static resources between maven modules

╄→гoц情女王★ 提交于 2019-12-05 01:38:32
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 the JAVA code was easy. The question I have is how to a share common static resources such as JavaScript, CSS, and image files without duplicating them in each web module? I would also like to do it in such a way that I can continue running the web app from Eclipse and have changes I make to the static-files automatically available to the Eclipse's

Serve html file in nodejs server

强颜欢笑 提交于 2019-12-04 22:46:08
I've been doing fine until I try to separate my code into routes, controllers and etc. Now I'm getting an error when I try to load the html file. When I go to the link http://localhost:3000/ I'm getting this error Error: ENOENT: no such file or directory, stat '/views/index.html' This is my routes.js code module.exports = function (app) { var userController = require('../controllers/userController'); // app.use(require('express').static('../app/views/index.html')); app.get('/', userController.renderHomePage); app.post('/find', userController.getUser); app.get('/get', userController.getUsers);

Can I have koa-static serve assets at a custom (e.g., /static/) path?

寵の児 提交于 2019-12-04 18:41:25
问题 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 , the URL to access a file ./some/dir/something.txt would be localhost:3000/something.txt . There doesn't seem to be a way to configure my app such that the same file (and all other files in the same dir) is served at localhost:3000/static/something

Load static files for all templates in django

会有一股神秘感。 提交于 2019-12-04 18:09:00
问题 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. 回答1: As of django 1.9, you can add the following to your template settings: 'builtins': ['django.contrib.staticfiles.templatetags.staticfiles'] For example, the whole template setting might look like this: TEMPLATES = [ { 'BACKEND': 'django.template.backends.django