Questions tagged [mod-headers]

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

109 questions
6
votes
3 answers

mod_rewrite not sending Vary: Accept-Language when RewriteCond matches

I have a rewrite rule which redirects to / if no Accept-Language header is present and someone attempts to visit ?lang=en. It works fine, except for the headers returned. Vary: Accept-Language is missing from the response. RewriteCond…
Lucent
  • 1,614
  • 1
  • 19
  • 22
6
votes
2 answers

Access-Control-Allow-Origin: 500 Internal Error

So I am trying to have siteA do a jquery .load of some content on siteB. In doing this, im getting the Access-Control-Allow-Origin Error. So on siteB, I placed a .htaccess file that should allow siteA to be able to grab content from it. I am…
David
  • 786
  • 3
  • 9
  • 19
6
votes
1 answer

mod_expires or mod_headers?

This page says this: If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive It seems like both of the mod_expires and…
trante
  • 33,518
  • 47
  • 192
  • 272
5
votes
1 answer

Apache won't set headers for PHP script

This .htaccess file: ExpiresActive On ExpiresDefault "access plus 4 month" Header merge X-ModHeaders "Yes, it is installed" ... works as expected in my…
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
5
votes
2 answers

Set multiple cookies in Apache

I'm trying to set two cookies in Apache (2.2), using mod_header, like so: Header set Set-Cookie "poodle=noodle;path=/;Secure;HttpOnly;Expires=Wed, Jan 01 2020 2:02:02 GMT" Header set Set-Cookie "tweedle=puddle;path=/;Secure;HttpOnly;Expires=Wed, Jan…
Spanky
  • 5,608
  • 10
  • 39
  • 45
4
votes
1 answer

how to simply a list of about 99 domains to enable CORS on?

I currently have .htaccess file that lists dozens of domains to enable CORS to from my server. I shortened my example below , but all the domain names are similar and the only part of the domain name that is changed is the 1 or 2 digit number after…
MShack
  • 642
  • 1
  • 14
  • 33
4
votes
1 answer

How to edit a cookie set via mod_rewrite?

I use mod_rewrite to set some cookies and then redirect the user to the target url. As these cookies are used in a third party environment, I have to set the flag SameSite=none. I tried to edit the Set-Cookie header via mod_headers, but I didn't get…
Xoldomir
  • 71
  • 1
  • 4
4
votes
1 answer

How to remove session cookie's secure flag using mod_header?

My Apache Tomcat is running behind an Apache httpd web server connected via mod_jk. When a browser requests https page (rather than http) as its first session request, Tomcat sends a session cookie with secure flag which makes user's logged in…
hotohoto
  • 490
  • 8
  • 20
4
votes
0 answers

htaccess - mod headers not working on a single file

I have .htaccess file with the following lines (along with other rules): Header always append X-Frame-Options DENY Header always append X-Content-Type-Options nosniff This lines are working for every file I checked except my main page (which is the…
Yaron U.
  • 7,681
  • 3
  • 31
  • 45
3
votes
1 answer

Read header into environment variable in Apache 2.2?

I want to process a request header using a custom rewrite map. Therefore I want to have the content of the header in an environment variable. I have not found a way to do that with mod_headers and/or mod_rewrite. Any help is appriciated.
The Surrican
  • 29,118
  • 24
  • 122
  • 168
3
votes
3 answers

CORS header ‘Access-Control-Allow-Origin’ does not match ‘(null)’, but it is not null

I have a simple AJAX request that calls http://myexamplefeed.com/feed/23213 I just moved this site to a new server, and all of a sudden I'm getting this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote…
symlink
  • 11,984
  • 7
  • 29
  • 50
3
votes
0 answers

Concatenate environment variable in Apache RequestHeader

Background: I am trying to set an Authorization header from my Apache VirtualHost config when a JWT is sent as a query parameter. I am really close to getting this to work, but I have run into one final issue. The header must be in the form…
Kirollos Morkos
  • 2,503
  • 16
  • 22
3
votes
1 answer

RequestHeader not getting set on RewriteRule in htaccess

The following RewriteRule in my htaccess file isn't getting the request header set. Header set Access-Control-Allow-Origin "*" RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} ^(.*)&someUser=(.*)$ RewriteRule ^(.*)SDM$…
3
votes
1 answer

apache Header vs RequestHeader

It seems that mod_headers directives Header and RequestHeade have the same functionality. It also seems that the only diference is that Header can read header information sent by PHP, while RequestHeader can not. is that right? The documentation for…
dev4life
  • 10,785
  • 6
  • 60
  • 73
3
votes
0 answers

Using mod_header to change cookie domains

We are splitting our website into multiple sub-domain and all of our existing cookies are tied to a single domain. I am trying to use Apache to edit the cookies to reset the domain but I am having issues with the correct way to do it. The issue is…
Wes
  • 847
  • 2
  • 10
  • 22