Software Development:
Individual Programming

How can I add an „expires“ header in my web server?

Question: 

Searching …

 

Unfortunately nothing found on "".

Premium support for Bitpalace web hosting customers only!

 from Fiji: +49 30 32 70 18 92, Fax (in Germany) +49 30 32 70 18 91

service@bitpalast.net 

Skype: bitpalast

One moment please … your browser is loading the page.

 

 

Symptom

You want to use browser caching for your static files like JavaScript .js, JPEG, GIF, and PNG images .jpg, .jpeg, .gif, .png, Icons .ico and cascaced style sheets .css.

 

Cause

Browser caching stores files that are change seldomly in the browser cache for a long time. These files will not be loaded from the server again if a user repeatedly visits the homepage, but they will be loaded from the browser cache. For the browser to know how long it shall store the static files in its cache, the server must send an “expires” header with the files.

 

Solution

At Bitpalace, static files like images, JavaScript files, icons and CSS files are handled by the Nginx reverse proxy that runs as a frontend to your Apache web server. Requests of these file types never reach Apache. They ease the server load and speed-up delivery of the static files to the browser dramatically. Nginx does not only need less system resources and processes data much faster than Apache, it caches the files in a server-side cache, too. This is one of the reasons for the high server speed that your website has with a Bitpalace hosting plan. If had previously tried to add an “expires” header by an .htaccess file, you were unsuccessful, because an .htaccess file only controls what the Apache web server gets to see.

By default, Nginx does not send an „expires“ header, because for many customers it is not desirable to keep static files in the browser cache for a long while. For Nginx to send an “expires” header, a configuration directive like this needs to be added to the Nginx server configuration:

location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}

In this example, .jpg, .jpeg, .png, .gif, .gif, .ico, .css and .js files would be stored in the users’s browser for 365 days and would not be downloaded from the server on return visits . This makes a website even faster and reduces the server load further, because the download of the files is omitted.

The procedure has a disadvantage, too: If file contents of static files change, users will not see the changes, because their browser will not download the latest version from the server until the file that was once downloaded and stored in the browser cache is older than 365 days.

You cannot configure the setting yourself, because the Nginx reverse proxy is administrated by the server admininstration. Our support be happy to add an “expires” header for you. We recommend to use the default as shown above, but you can have your own file extensions and expires value, too. Please simply send an e-mail to support, if you want this special configuration.

 

Overview of frequently asked questions 

 

 

 


 

Additional Services

Cheap web space for less than 1 US$/month 

Starter Server: Affordable web server from  2.25 US$ () /month with PHP, database and many more 

Online Reservation System: Occupancy & vacancy schedule for any ressources (vehicles, sports facilities …) & guest houses, holiday apartments …  1.05 US$ () /month 

 

FAQ – frequently asked questions 

 

Software development (programming, programmers) in selected countries

Cuba

Austria

Kenya

Guyana

Panama

Lesotho

Liberia

Antigua and Barbuda

Paraguay

Peru

Cameroon

Argentina

Costa Rica

Australia

Germany

Bahamas

Madagascar

Barbados

Belize

Uganda

India

Philippines

Malta

Bolivia

Botswana

Marshall Islands

Chile

Puerto Rico

Ireland

Mauritius

Rwanda

Saint Kitts and Nevis

Saint Vincent and the Grenadines

Saint Lucia

Mexico

Zambia

Samoa

Jordan

Micronesia, Federated States of

Switzerland

Dominican Republic

Malawi

Seychelles

Namibia

Kiribati

Dominican Republic

Nauru

Sierra Leone

New Zealand

Ecuador

Singapore

El Salvador

Gambia

Solomon Islands

Ghana

Spain

Nicaragua

Sudan

Nigeria

Swaziland

South Africa

Pakistan

Palau

Tanzania, United Republic of

Colombia

Grenada

Tonga

Trinidad and Tobago

Honduras

Tuvalu

Uruguay

Papua New Guinea

Venezuela

United States

Jamaica

Canada

Guatemala

Guinea

United Kingdom

Zimbabwe

 

"software development": programmer, programming, database design, interface, software developers, outsourcing, insourcing, off shore, program development, documentation, software manual, optimization, optimizing, scripting, script, revise program, revision, document software, prices for programming, Windows, Unix (z.B. Solaris, Linux, FreeBSD), Assembler, C, C++, JAVA, PHP, JavaScript & AJAX, VisualBasic, Cobol, Informix 4GL, SQL/MySQL, ADABAS, MS Access, Oracle, ARIS, Prozess 2000, Visio, MS Office (Word, Excel PowerPoint, MS Project), Automation mit VisualBasic, MS Windows Server und Clients, SAP R/3, Macromedia MX Studio, MS Frontpage, MS Expression Web, Smarty Template Engine, Joomla, Redaxo, osCommerce, OXID eSales Community Edition, OrgaMAX Web Export.

  from Fiji: +49 30 32 70 18 92 •  GmbH, Sensburger Allee 27, D-14055 Berlin (Germany)
Your purchase is tax-free, because you order from a non-EU country. © 2024  GmbH. All rights reserved. and the logo are registered trademarks of GmbH. For photo credits see imprint.

Imprint Privacy policy Sitemap