An Apache module which provides directives to control and modify HTTP request and response headers.
Questions tagged [mod-headers]
109 questions
3
votes
1 answer
mod_headers module does not load, though it's enabled in httpd.conf
I need mod_headers to force download of a file depending on GET parameter.
#Download header
Header set Content-Disposition "attachment"
Code above…

Tomáš Zato
- 50,171
- 52
- 268
- 778
2
votes
1 answer
Apache RewriteRule: bad flag delimiters "FilesMatch"
This is my .htaccess file in the head
RewriteRule ([^/]+)\.pdf $ - [E=FILENAME:$1]
Header add Link…

Zekura
- 317
- 4
- 13
2
votes
2 answers
.htaccess: How to check if a request header exists with .htaccess?
I searched for hours, but it seems Apache has no solution for my need. I need to check if a request header is present and depending on it I want to define a rewrite rule. I can check if the header value is empty, but if the header doesn't exist such…

Serpentdriver
- 93
- 8
2
votes
0 answers
ModHeader Extension with Axios Inteceptor
We are trying to create internal framework for mocking api calls. As part of that we are using ModHeader chrome extension to add custom headers for the request. Headers whatever we added in the extension not coming in axios interceptor, but in…

Srigar
- 1,648
- 3
- 14
- 28
2
votes
1 answer
How to set Apache header only if environment variable has a certain value
I want to set a header in my Apache (2.4) config, but only if an environment variable has a certain value.
SetEnv ENV_NAME prod
How do I only set this header if ENV_NAME is not prod ?
Header set X-Robots-Tag "noindex, nofollow"

BadHorsie
- 14,135
- 30
- 117
- 191
2
votes
1 answer
Apache: Created Headers in .htaccess file sent twice when requesting PHP file
I am trying to set up a .htaccess file with the following content with Apache 2.2.31:
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
This is working fine but not for PHP files. The Header is sent twice. I…
user9213758
2
votes
1 answer
I'm not able to launch mod header extension with selenium
While I'm trying to launch mod header extension with selenium i'm getting error message : "Requests to the server have been blocked by an extension.
Try disabling your extensions.
ERR_BLOCKED_BY_CLIENT"
Im using selenium 3.0.4
Code in…

prabhudotpy
- 31
- 1
- 7
2
votes
0 answers
How to set HSTS header from .htaccess to force loading assets via https
After switching to https and adding following lines to .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Header set Strict-Transport-Security…

Dawid Adach
- 749
- 5
- 27
2
votes
2 answers
Apache mod_headers: can't edit set-cookie header
I'm trying to modify domain for which the cookie is valid with mod_headers:
From:
ipa_session=e88331a44e20d8b5caaacb0e896029fe; Domain=internal.example.com; Path=/ipa; Expires=Tue, 13 Dec 2016 09:31:33 GMT; Secure;…

Misko
- 1,542
- 2
- 19
- 31
2
votes
1 answer
Can I both use ProxyPreserveHost and RequestHeader set Host in Apache VirtualHost?
I am trying to set the host in the request header to "server2" for when ProxyPass directs the request to server2 but preserve the host in all other cases (when it passes it to server1).
RequestHeader set Host…

mrg
- 431
- 3
- 6
2
votes
0 answers
installing mod_headers on Linux, apache 2.2.21
Trying to install the mod_headers to be able to append a HTTP header with the Header directive. But the installation process doesn't show the header module as being installed.
Did the following steps. Switched over to the httpd installation and…

Matthew Campbell
- 1,864
- 3
- 24
- 51
2
votes
1 answer
(Apache) Regex to match a specific cookie name+value (to strip/remove it)?
I am trying to use a "RequestHeader edit" directive to take the "Cookie" header, and remove a specific cookie from that header.
In other words, suppose the incoming "Cookie" header was:
Cookie: header1=123; myheader=abc; header2=789
I want to use…

user555303
- 1,146
- 3
- 20
- 44
2
votes
2 answers
htaccess mod_headers for no-caching
We have an application that allows users to add/edit/replace/delete content (text, images, swfs, mp3s, etc). We want the admins to always have the latest updated files by using a no-cache header and when a user runs the application, everything…

fanfavorite
- 5,128
- 1
- 31
- 58
1
vote
0 answers
Properly formatted caching for .htaccess file
I just wish to check If code for .htacess file is good. I wish to implement catching on site, so I found code and edited just time for my needs.
I wish to cache flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|swf files for 1 month, gif|jpg|jpeg|png|js|css…

Advanced SEO
- 387
- 1
- 4
- 18
1
vote
0 answers
Expression-support workaround for older Apache httpd Versions (2.4.8)
I am in the unfortunate situation to use an older Apache httpd 2.4.8, and want to use expressions such as base64 encoding with mod_headers.
According to the documentation expr=value support was added to mod_headers in 2.4.10. What might be a viable…

Mirko Sertic
- 11
- 2