Questions tagged [mod-headers]

An Apache module which provides directives to control and modify HTTP request and response headers.

109 questions
1
vote
1 answer

Rewrite rule not working properly on Apache 2.2.15

On my local Linux machine I'm running an Apache 2.2.15 server. I would like to set an .htaccess RewriteRule in order to set a response header whenever a certain URL query string (?print=pdf&redirect=false) is matched. Example…
1
vote
1 answer

In htaccess, how to set a response header for all URLs of except one?

I want to use this rule: Header always set X-FRAME-OPTIONS "DENY" But only for the front pages of my website. I.e. I have a backoffice : example.com/gestion for which I don't want the rule to apply and I want to…
ailauli69
  • 522
  • 6
  • 19
1
vote
1 answer

.htaccess Variables Issue Unrecognized header format %

I am building out a sort of Content Security Policy generator for one of my sites. I am stumped by one particular section of the .htaccess portion of it The generated .htaccess is: # Media Sources SetEnv CSP_Media "media-src 'self' ;" # Default…
Kevin
  • 2,684
  • 6
  • 35
  • 64
1
vote
0 answers

onsuccess and always mod_header Apache2.4 and cache control

Apache2.2 this rule worked fine for curl -I when content is not cached. Header always set Cache-Control "public, max-age=86400" Moving to 2.4 cache control header is missing on curl -I ,but works fine for GET request when content is pulled from AEM…
Rakesh
  • 35
  • 5
1
vote
1 answer

In Apache .htaccess, set Header set Content-disposition, how to pass the filename from QUERY_STRING value

In Apache .htaccess, I have below block to force download. ForceType application/octet-stream Header set "Content-disposition" "attachment; filename=download.doc" This works fine. Now I need to make…
Rudolph
  • 139
  • 1
  • 8
1
vote
1 answer

httpOnly flag not working using Apache mod_headers

I've written this rule to add httpOnly flag to each cookie but the result was that. What's wrong with the rule? Header edit Set-Cookie ^(.*)$ "$1;HttpOnly;Secure" [EDIT] I've tried to do this treatment at backend, but it's using servlet 2.4 and…
1
vote
2 answers

What means e in htaccess?

I want to add a non-parameter canonical link to all parametrized URLs. I try to do this on the following way: ### Catching all URLs with non-empty parameter ### RewriteCond %{QUERY_STRING} . ### Adding to all…
Evgeniy
  • 2,337
  • 2
  • 28
  • 68
1
vote
1 answer

How to write an Apache environment variable value to a header

I'm using Apache server and trying to add for each request, a response header, with a value of some environment variable. For example: Header set MyHeader %{REQUEST_STATUS} The above configuration adds the header with the value (null). What is the…
odavid
  • 629
  • 1
  • 6
  • 17
1
vote
1 answer

Is it possible to set a header based on the UAGENT in htaccess

Because microsoft internet explorer and microsoft edge don't support content security policy version 2 or, in case of IE, don't support it at all I would like to change the content security policy based on the user agent. This is fairly simple with…
RvdM
  • 95
  • 1
  • 7
1
vote
2 answers

Enabling and modifying Chome Extensions in default NightWatch browser instance (specifically ModHeader extension)

I am using NightWatch.js and for some UI tests and I want to start the default browser instance with the some extra desiredCapabilities (i.e. an extension is enabled with some specific values applied). Note: I can perform the actions but not within…
1
vote
1 answer

Apache mod_headers cannot unset header on a path

I am trying to set a header using mod_headers in Apache in all cases EXCEPT a certain path. I've tried each of the three variations below to do so, but none of them seem to work properly to exclude the path. In ALL cases I get the header for all…
1
vote
1 answer

Noindex Session ID pages with htaccess

I have many pages with the parameter SID= indexed in Google which I would like to noindex, eg https://www.example.com.au/checkout/cart/?SID=c79e6055436bf371a02f4d2601cecd03 I have used the following code in htaccess but it doesn't seem to…
1
vote
0 answers

Apache httpd mod_headers disobedience

I have a client sending basic authentication credentials in a header named "Basic authentication", instead of the correct "Authorization". I can't fix the client, so I'm trying to work around the problem on the server. This works and sets the…
1
vote
1 answer

Why does the file size matter for apache command Header append Vary User-Agent to trigger?

I'm using symfony 3, and have the following .htaccess file (attached to the very bottom of this message noted as 'problem .htaccess'). I'm using the website gtmetrix.com (which uses pagespeed) to optimize my site, but I'm getting the following…
Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154
1
vote
1 answer

mod_expires.c and mod_headers.c not working according to google pagespeed insights

When running a test on google pagespeed insights I get the error "Leverage browser caching" What I have done Confirm that modules are enabled and working in Apache. As you can see here: http://noram.dk/phpinfo.php both mod_expires and mod_headers…