Apache Header Module Loaded but can't set headers in htaccessApache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcatApache won't serve images larger than ~2KApache Content-Type encoding changing from UTF-8 to iso-88591 from directory to directoryApache/2.2.20 (Ubuntu 11.10) gzip compression won't work on php pages, content is chunkedMy Apache 2.2 local test server with php none cgi automaticly removes logged in ipad usersApache forces Cache-Control: private automatically for HTTPS requestsApache / Nginx / Varnish - GZIP does not work on css, jsApache web server response header expireshtaccess conditional header set is ignoring the conditionredirect http to https using .htaccess failing
Is the seat-belt sign activation when a pilot goes to the lavatory standard procedure?
Does it matter what way the tires go if no directional arrow?
Does the wearer know what items are in which patch in the Robe of Useful items?
To whom did Varys write those letters in Game of Thrones S8E5?
Do crew rest seats count towards the maximum allowed number of seats per flight attendant?
Developers demotivated due to working on same project for more than 2 years
What is this weird d12 for?
With today's technology, could iron be smelted at La Rinconada?
Would life always name the light from their sun "white"
Why were the bells ignored in S8E5?
Does addError() work outside of triggers?
What do you call the hair or body hair you trim off your body?
c++ conditional uni-directional iterator
How to not get blinded by an attack at dawn
Can I say: "When was your train leaving?" if the train leaves in the future?
Could there be something like aerobatic smoke trails in the vacuum of space?
Meaning of "legitimate" in Carl Jung's quote "Neurosis is always a substitute for legitimate suffering."
Should I communicate in my applications that I'm unemployed out of choice rather than because nobody will have me?
When did game consoles begin including FPUs?
What do the "optional" resistor and capacitor do in this circuit?
Promotion comes with unexpected 24/7/365 on-call
Why doesn't Iron Man's action affect this person in Endgame?
the correct order of manual install WP and SSL on server
Why do galaxies collide
Apache Header Module Loaded but can't set headers in htaccess
Apache2 - mod_expire and mod_rewrite not working in httpd.conf - serving content from tomcatApache won't serve images larger than ~2KApache Content-Type encoding changing from UTF-8 to iso-88591 from directory to directoryApache/2.2.20 (Ubuntu 11.10) gzip compression won't work on php pages, content is chunkedMy Apache 2.2 local test server with php none cgi automaticly removes logged in ipad usersApache forces Cache-Control: private automatically for HTTPS requestsApache / Nginx / Varnish - GZIP does not work on css, jsApache web server response header expireshtaccess conditional header set is ignoring the conditionredirect http to https using .htaccess failing
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have Apache 2.2.29 (unix) setup and running on my new dev machine (mac). I am trying to set CORS headers for an API project - something that I have done many times.
The htaccess file for the project looks like this:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
ServerSignature Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/public
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_URI !^/(favicon.ico|apple-touch-icon.*.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
and the headers module is loaded in my conf:
LoadModule headers_module libexec/mod_headers.so
The module file exisits in the location shown in the apache conf and is it loaded OK:
dan$ httpd -M
Loaded Modules:
core_module (static)
mpm_event_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
...
headers_module (shared)
I have also checked the conf override settings in my main conf and the included vhosts conf:
<Directory "/Users/dan/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
However, headers aren't being set as expected. Heres the response headers when making a request to an API project using the above htaccess file:
HTTP/1.1 200 OK
Date: Wed, 22 Jul 2015 10:36:05 GMT
Server: Apache/2.2.29 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_ssl/2.2.29 OpenSSL/1.0.2c
Expires: Wed, 15 Jul 2015 10:36:05 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
I have tested the application setup in other apache environments and it is working as expected...so it's definitely something to do with my setup. It's driving me crazy!
Any thoughts?
Dan
apache-2.2 .htaccess httpd.conf http-headers cors
add a comment |
I have Apache 2.2.29 (unix) setup and running on my new dev machine (mac). I am trying to set CORS headers for an API project - something that I have done many times.
The htaccess file for the project looks like this:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
ServerSignature Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/public
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_URI !^/(favicon.ico|apple-touch-icon.*.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
and the headers module is loaded in my conf:
LoadModule headers_module libexec/mod_headers.so
The module file exisits in the location shown in the apache conf and is it loaded OK:
dan$ httpd -M
Loaded Modules:
core_module (static)
mpm_event_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
...
headers_module (shared)
I have also checked the conf override settings in my main conf and the included vhosts conf:
<Directory "/Users/dan/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
However, headers aren't being set as expected. Heres the response headers when making a request to an API project using the above htaccess file:
HTTP/1.1 200 OK
Date: Wed, 22 Jul 2015 10:36:05 GMT
Server: Apache/2.2.29 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_ssl/2.2.29 OpenSSL/1.0.2c
Expires: Wed, 15 Jul 2015 10:36:05 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
I have tested the application setup in other apache environments and it is working as expected...so it's definitely something to do with my setup. It's driving me crazy!
Any thoughts?
Dan
apache-2.2 .htaccess httpd.conf http-headers cors
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23
add a comment |
I have Apache 2.2.29 (unix) setup and running on my new dev machine (mac). I am trying to set CORS headers for an API project - something that I have done many times.
The htaccess file for the project looks like this:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
ServerSignature Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/public
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_URI !^/(favicon.ico|apple-touch-icon.*.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
and the headers module is loaded in my conf:
LoadModule headers_module libexec/mod_headers.so
The module file exisits in the location shown in the apache conf and is it loaded OK:
dan$ httpd -M
Loaded Modules:
core_module (static)
mpm_event_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
...
headers_module (shared)
I have also checked the conf override settings in my main conf and the included vhosts conf:
<Directory "/Users/dan/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
However, headers aren't being set as expected. Heres the response headers when making a request to an API project using the above htaccess file:
HTTP/1.1 200 OK
Date: Wed, 22 Jul 2015 10:36:05 GMT
Server: Apache/2.2.29 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_ssl/2.2.29 OpenSSL/1.0.2c
Expires: Wed, 15 Jul 2015 10:36:05 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
I have tested the application setup in other apache environments and it is working as expected...so it's definitely something to do with my setup. It's driving me crazy!
Any thoughts?
Dan
apache-2.2 .htaccess httpd.conf http-headers cors
I have Apache 2.2.29 (unix) setup and running on my new dev machine (mac). I am trying to set CORS headers for an API project - something that I have done many times.
The htaccess file for the project looks like this:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
ServerSignature Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/public
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteCond %REQUEST_URI !^/(favicon.ico|apple-touch-icon.*.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
and the headers module is loaded in my conf:
LoadModule headers_module libexec/mod_headers.so
The module file exisits in the location shown in the apache conf and is it loaded OK:
dan$ httpd -M
Loaded Modules:
core_module (static)
mpm_event_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
...
headers_module (shared)
I have also checked the conf override settings in my main conf and the included vhosts conf:
<Directory "/Users/dan/Sites">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
However, headers aren't being set as expected. Heres the response headers when making a request to an API project using the above htaccess file:
HTTP/1.1 200 OK
Date: Wed, 22 Jul 2015 10:36:05 GMT
Server: Apache/2.2.29 (Unix) DAV/2 mod_fastcgi/2.4.6 mod_ssl/2.2.29 OpenSSL/1.0.2c
Expires: Wed, 15 Jul 2015 10:36:05 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
I have tested the application setup in other apache environments and it is working as expected...so it's definitely something to do with my setup. It's driving me crazy!
Any thoughts?
Dan
apache-2.2 .htaccess httpd.conf http-headers cors
apache-2.2 .htaccess httpd.conf http-headers cors
asked Jul 22 '15 at 11:04
Dan LakeDan Lake
3114
3114
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23
add a comment |
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23
add a comment |
2 Answers
2
active
oldest
votes
If you're still interested in solving the issue I have some suggestions. The basic idea of the configuration is fine, I tested it on a simple setup and the headers were set correctly.
This means the issue is probably to do with the htaccess file and the servers ability to use it. I would first try putting "rubbish" into the htaccess file (anything that is not valid Apache configuration). If the htaccess file is being read correctly all requests that cause the file to be read will generate a 500 Internal Server Error
.
Next run apachectl -S
and check the output, put it in your question if you are unsure. You need to make sure that the request maps to the <Directory>
block in your question. I'm afraid there is little you can do except search through your configuration files. While you do this make sure AllowOverride is not overridden somewhere.
Also you are using mod_fastcgi, so depending on your configuration, the request may not be mapping to a directory on the file system at all, which is required for the htaccess file to be read.
add a comment |
For all who still have this problem:
for me it helped to changeallowOverride None
to allowOverride All
in the httpd.conf file
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f707599%2fapache-header-module-loaded-but-cant-set-headers-in-htaccess%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you're still interested in solving the issue I have some suggestions. The basic idea of the configuration is fine, I tested it on a simple setup and the headers were set correctly.
This means the issue is probably to do with the htaccess file and the servers ability to use it. I would first try putting "rubbish" into the htaccess file (anything that is not valid Apache configuration). If the htaccess file is being read correctly all requests that cause the file to be read will generate a 500 Internal Server Error
.
Next run apachectl -S
and check the output, put it in your question if you are unsure. You need to make sure that the request maps to the <Directory>
block in your question. I'm afraid there is little you can do except search through your configuration files. While you do this make sure AllowOverride is not overridden somewhere.
Also you are using mod_fastcgi, so depending on your configuration, the request may not be mapping to a directory on the file system at all, which is required for the htaccess file to be read.
add a comment |
If you're still interested in solving the issue I have some suggestions. The basic idea of the configuration is fine, I tested it on a simple setup and the headers were set correctly.
This means the issue is probably to do with the htaccess file and the servers ability to use it. I would first try putting "rubbish" into the htaccess file (anything that is not valid Apache configuration). If the htaccess file is being read correctly all requests that cause the file to be read will generate a 500 Internal Server Error
.
Next run apachectl -S
and check the output, put it in your question if you are unsure. You need to make sure that the request maps to the <Directory>
block in your question. I'm afraid there is little you can do except search through your configuration files. While you do this make sure AllowOverride is not overridden somewhere.
Also you are using mod_fastcgi, so depending on your configuration, the request may not be mapping to a directory on the file system at all, which is required for the htaccess file to be read.
add a comment |
If you're still interested in solving the issue I have some suggestions. The basic idea of the configuration is fine, I tested it on a simple setup and the headers were set correctly.
This means the issue is probably to do with the htaccess file and the servers ability to use it. I would first try putting "rubbish" into the htaccess file (anything that is not valid Apache configuration). If the htaccess file is being read correctly all requests that cause the file to be read will generate a 500 Internal Server Error
.
Next run apachectl -S
and check the output, put it in your question if you are unsure. You need to make sure that the request maps to the <Directory>
block in your question. I'm afraid there is little you can do except search through your configuration files. While you do this make sure AllowOverride is not overridden somewhere.
Also you are using mod_fastcgi, so depending on your configuration, the request may not be mapping to a directory on the file system at all, which is required for the htaccess file to be read.
If you're still interested in solving the issue I have some suggestions. The basic idea of the configuration is fine, I tested it on a simple setup and the headers were set correctly.
This means the issue is probably to do with the htaccess file and the servers ability to use it. I would first try putting "rubbish" into the htaccess file (anything that is not valid Apache configuration). If the htaccess file is being read correctly all requests that cause the file to be read will generate a 500 Internal Server Error
.
Next run apachectl -S
and check the output, put it in your question if you are unsure. You need to make sure that the request maps to the <Directory>
block in your question. I'm afraid there is little you can do except search through your configuration files. While you do this make sure AllowOverride is not overridden somewhere.
Also you are using mod_fastcgi, so depending on your configuration, the request may not be mapping to a directory on the file system at all, which is required for the htaccess file to be read.
answered Sep 27 '16 at 7:30
UnbelieverUnbeliever
1,7411414
1,7411414
add a comment |
add a comment |
For all who still have this problem:
for me it helped to changeallowOverride None
to allowOverride All
in the httpd.conf file
add a comment |
For all who still have this problem:
for me it helped to changeallowOverride None
to allowOverride All
in the httpd.conf file
add a comment |
For all who still have this problem:
for me it helped to changeallowOverride None
to allowOverride All
in the httpd.conf file
For all who still have this problem:
for me it helped to changeallowOverride None
to allowOverride All
in the httpd.conf file
edited Oct 1 '18 at 18:20
Jenny D
24.4k116296
24.4k116296
answered Oct 1 '18 at 15:30
wolfiwolfi
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f707599%2fapache-header-module-loaded-but-cant-set-headers-in-htaccess%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you ever solve this? As I'm having the identical issue on my osx setup.
– Owen Melbourne
May 16 '16 at 11:02
No, unfortunately not. My setup was a hand cranked Apache, PHP, MySQL install using homebrew and trying to fix it nearly drove me to insanity! In the end I gave up and installed MAMP. Completely unsatisfying solution but it got around the problem for me.
– Dan Lake
May 19 '16 at 8:23