mod-headers

how to use mod_headers and mod_expires to cache

前提是你 提交于 2019-12-03 02:31:06
问题 I want to cache images and other files on my site, so what I did is made sure mod_headers and mod_expires with :- /usr/sbin/httpd -l then edited .htaccess to be:- ExpiresActive On ExpiresDefault A0 # Set up caching on media files for 1 year (forever?) <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> ExpiresDefault A29030400 Header append Cache-Control "public" </FilesMatch> # Set up caching on media files for 1 week <FilesMatch "\.(gif|jpg|jpeg|png|swf)$"> ExpiresDefault A604800

how to use mod_headers and mod_expires to cache

我的梦境 提交于 2019-12-02 16:23:52
I want to cache images and other files on my site, so what I did is made sure mod_headers and mod_expires with :- /usr/sbin/httpd -l then edited .htaccess to be:- ExpiresActive On ExpiresDefault A0 # Set up caching on media files for 1 year (forever?) <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> ExpiresDefault A29030400 Header append Cache-Control "public" </FilesMatch> # Set up caching on media files for 1 week <FilesMatch "\.(gif|jpg|jpeg|png|swf)$"> ExpiresDefault A604800 Header append Cache-Control "public" </FilesMatch> # Set up 2 Hour caching on commonly updated files

How to check mod_headers and mod_expires modules enabled in apache

北慕城南 提交于 2019-11-30 03:44:35
I want to check whether mod_headers and mod_expires modules enabled or not in my server Is there a way available to list apache enabled/disabled modules using some php function just like we list php information with phpinfo(); function? speeves On Debian: user@machine:~$ /usr/sbin/apache2 -l Most GNU/Linux distros: user@machine:~$ /usr/sbin/httpd -l Ubuntu: user@machine:~$ ls /etc/apache2/mods-enabled On Mac OSX: user@mymac:~$ httpd -l On Win 7 (64-bit): C:\Users\myuser>"\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -l Try these commands from a terminal window in all

Set Apache headers conditionally

回眸只為那壹抹淺笑 提交于 2019-11-29 01:53:30
I'm working with an apache server, and I'd like to add headers conditionally. If the URI matches a certain regex, I'd like to add the header Access-Control-Allow-Origin: * . What is a good way to do this? What I've tried so far: I added code called by the request handler, using apr_table_add(rq->headers_out, "Access-Control-Allow-Origin", "*") . But it seems like Apache strips the header before sending the response whenever the header Content-Type: application/x-javascript is also set. Is this the wrong way to do it? Why would Apache strip the header? I've heard mod_headers suggested. Does mod

How to check mod_headers and mod_expires modules enabled in apache

独自空忆成欢 提交于 2019-11-29 00:45:06
问题 I want to check whether mod_headers and mod_expires modules enabled or not in my server Is there a way available to list apache enabled/disabled modules using some php function just like we list php information with phpinfo(); function? 回答1: On Debian: user@machine:~$ /usr/sbin/apache2 -l Most GNU/Linux distros: user@machine:~$ /usr/sbin/httpd -l Ubuntu: user@machine:~$ ls /etc/apache2/mods-enabled On Mac OSX: user@mymac:~$ httpd -l On Win 7 (64-bit): C:\Users\myuser>"\Program Files (x86)

Mod_deflate and mod_header settings?

一个人想着一个人 提交于 2019-11-28 20:55:58
I've finally gotten a VPS hosting account set up this allows me to use mod_deflate and mod_header (of course). I'm attempting to make my site faster by YSlow's guidelines which include gzipping (via mod_deflate) the pages and setting a long expire header. What would the .htaccess code for this look like? I've seen various examples but I'm wondering what it would look like to fit those parameters. For example # Mod_deflate <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript SetEnvIfNoCase Request

Add Secure and httpOnly Flags to Every Set-Cookie Response in Apache httpd

﹥>﹥吖頭↗ 提交于 2019-11-28 19:15:51
问题 I'm running Apache 2.2.26: Server version: Apache/2.2.26 (Unix) Server built: Jan 17 2014 12:24:49 Cpanel::Easy::Apache v3.22.30 rev9999 +cloudlinux I'm attempting to use mod_headers to edit Set-Cookie headers and add the secure or httpOnly flag, but its not working at all (Does nothing, doesn't give HTTP 500 error). I can use the "modify" "append", directives of the Header command without an issue, just not the edit. I do not know why... I've tried many combinations, but this is what I have

Apache won't set headers for PHP script

痞子三分冷 提交于 2019-11-28 12:33:08
This .htaccess file: <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 4 month" </IfModule> <IfModule mod_headers.c> Header merge X-ModHeaders "Yes, it is installed" </IfModule> ... works as expected in my development box (Windows box, Apache/2.4.10, PHP running as Apache module), where "works" means that it generates the appropriates headers for all resources (static or dynamic). However, in my production server (Linux box, Apache/2.2.31, PHP running as FastCGI with mod_fcgid/2.3.9) it only works for static assets, not for PHP scripts. Am I right suspecting that difference

How to set HSTS header from .htaccess only on HTTPS

好久不见. 提交于 2019-11-27 00:00:36
问题 My web application runs on a different number of hosts that I control. To prevent the need to change the Apache config of each vhost, I add most of the config using .htaccess files in my repo so the basic setup of each host is just a couple of lines. This also makes it possible to change the config upon deploying a new version. Currently the .htaccess (un)sets headers, does some rewrite magic and controls the caching of the UA. I want to enable HSTS in the application using .htaccess. Just