An Apache module which provides directives to control and modify HTTP request and response headers.
Questions tagged [mod-headers]
109 questions
0
votes
1 answer
Apache2 - Rewrite Response header Key
How can I rewrite response headers within the apache2 conf? Is this even possible?
We are using apache2 for legacy services which connects to a service behind an envoy proxy.
Envoy always set the response and request header to lower-case. Their…

Igor Williams
- 1
- 1
0
votes
0 answers
Apache mod-proxy modify header as Forward Proxy
i'm using apache server as proxy in order to add some custom headers to the request forwarded to a website on the internet. I want apache like a man in the middle. The browser send a request, apache receives it, it add some headers and then apache…

Matteo Bellarasa
- 41
- 1
- 4
0
votes
1 answer
Apache returning null for environment variables in header
I am trying to troubleshoot my apache test site right now. I need to have the mod_rewrite variables returned in the header so that I can see what is going on. However, when I try to set them in the header, I get null
Server version: Apache/2.4.51…
0
votes
1 answer
Internal Server Error when add Header set Access-Control-Allow-Methods to Htaccess
I would like to add an authorization to my web site through htaccess.
I added this code :
# BEGIN Cache-Control Headers
Header set Access-Control-Allow-Origin: https://www.example.com
Header set…

MAZ
- 222
- 1
- 14
0
votes
3 answers
How to add new request header to chrome webdriver in robot framework
I need to add a new request header to chrome webdriver. In manual test, we are using ModHeader extension to add new custom request header to the browser.
I tried following option, but did not work.
${options}= Evaluate …

Govi
- 1
- 1
0
votes
0 answers
How to unset or change headers using Apache webserver?
What I tried to do is to embed an iframe into a website and was faced with Content Security Policy.
I know this question was asked before, but I couldn’t find any working solution.
Error message:
Content security policy: 'x-frame-options' will…

loxlay
- 11
- 3
0
votes
1 answer
Apache mod_headers regex for multiple cookies?
I'm using the following code to edit set the SameSite attribute for specific cookies:
Header always edit Set-Cookie ^(login_session.*)$ $1;SameSite=Strict
Header always edit Set-Cookie ^(different_cookie.*)$…

Ivan
- 1,274
- 16
- 22
0
votes
0 answers
Browsing web site root fails when TRACK/TRACE/OPTIONS options are turned on in .htaccess
I have the following block in my .htaccess file
RewriteEngine On
RewriteRule %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS)
RewriteRule .* - [F]
I would expect this to block the OPTIONS / TRACK and…

Welsh King
- 3,178
- 11
- 38
- 60
0
votes
0 answers
Setting Apache mod_headers while we access directory any directory?
I am using apache 2.2. I have to set header for home page url only. e.g If url is https://www.example.com then I need to set header for this URL only. Could you please help me on this?
I have tried below things but no luck.
If condition used but…

Dadasaheb More
- 1
- 1
0
votes
1 answer
Setting env variable in httpd and accessing them in Response headers
I have the following conf. I am trying to set a cookie with a value which I extracted in the rewrite rule. But the value of the cookie being always set to null. Is it a problem with the regex or I am trying to do something wrong here. I am…

Niranjan
- 517
- 2
- 4
- 21
0
votes
1 answer
How do I serve CSP based on client IP with multiple IP's in .htaccess?
-Mac
-Apache
-PHP7
-Wordpress
I want to serve a lenient CSP to my self and another person(s), but have a strict CSP for everyone else. The code I currently use works when I just use my own IP, but I can't figure out how to add another. I'm a…

JLB
- 11
- 4
0
votes
1 answer
Apache mod_headers modification not passing through on ProxyPass
I have web socket GET requests that are coming to an Apache http sever and are being forwarded to a Apache Tomcat 8.5.x server (represented here as 192.168.1.77:80).
I'm attempting to use mod_headers to set the "upgrade" header value.
Inside my…

Mark Nenadov
- 6,421
- 5
- 24
- 32
0
votes
1 answer
mod_headers for controlling access - won't work
Exactly as described here, I add this thing to httpd.conf:
Header add Access-Control-Allow-Origin "*"
As it is described in w3.org, I tried all places: , , and ... After every…

shal
- 2,854
- 4
- 20
- 31
0
votes
1 answer
Getting environment variable in mod_headers from mod_rewrite
I'm trying to send a header based on an environment variable and according to the documentation I'm supposed to use the env condition.
However it is not working. This is my server configuration:
RewriteRule ([^\[]+)(?:\[immutable\].)js$ $1.js…

rink.attendant.6
- 44,500
- 61
- 101
- 156
0
votes
1 answer
Not Able to Set HeaderRequest with httpd on Amazon Linux behind Load Balancer
We have a configuration where we front the server with EC2 Load Balancer. Because of that, it seems that the "Host" is not properly set when it reaches the server. Because of that we are trying to set the value using the proxy, but it doesn't seem…

juminoz
- 3,168
- 7
- 35
- 52