You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ross Garinger <ro...@jusme.org> on 2012/05/23 19:22:37 UTC
[users@httpd] mod_fcgid setting content-type header
Hi,
I am running PHP through mod_fgcid using the following setup in a conf file:
<IfModule !mod_php4.c>
<IfModule !mod_php4_filter.c>
<IfModule !mod_php5.c>
<IfModule !mod_php5_filter.c>
<IfModule !mod_php5_hooks.c>
<IfModule mod_actions.c>
<IfModule mod_alias.c>
<IfModule mod_mime.c>
<IfModule mod_fcgid.c>
<IfModule mod_headers.c>
DefaultInitEnv PHPRC=/etc/php5/cgi
#DefaultInitEnv PHP_FCGI_MAX_REQUESTS 5000
AddHandler php-fcgi .php .css
Action php-fcgi /fcgi-bin/php-fcgi-wrapper
AddType application/x-httpd-php .php .css
<FilesMatch "\.css$">
Header set Content-type "text/css"
</FilesMatch>
Alias /fcgi-bin/ /var/www/fcgi-bin.d/php5-default/
<Location /fcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI
Order Allow,Deny
Allow from All
</Location>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
As you can see, in addition to parsing .php files as PHP, I am also parsing
.css files as PHP. This is indeed working, however the Content-type is not
being set correctly in the response headers from my server. The
Content-type for .css files is still text/html. I added the <FilesMatch
"\.css$"> directive to try to set the Content-type, but that is not
working. I'm guessing that the fact that I'm using mod_fcgid has something
to do with this, as the mod_fcgid processing is probably rewriting the
Content-type to text/html after I set it to text/css? I've tried several
different permutations including the ForceType directive, but I just can't
get the Content-type set correctly. The only approach I've found that works
is to stick a header("Content-type: text/css") at the top of my css files,
which is inconvenient to say the least. Anyone have a solution for this?
Thanks,
Ross
Re: [users@httpd] mod_fcgid setting content-type header
Posted by Ross Garinger <ro...@jusme.org>.
Eric,
Thanks for your response. That's sort of what I figured since processing is
handed over to fcgi to complete the request then httpd has no control at
that point, and any response headers that were set before by httpd could
be overwritten. The strange thing is that I have a similar block of code
on a mod_php server that isn't working either. I have found numerous
resourced online that say a 'Header set Content-type "text/css"'
directive should work for a regular old mod_php setup.
-Ross
----- Original Message -----
From: Eric Covener <co...@gmail.com>
To: users@httpd.apache.org
Date: Wed, 23 May 2012 13:44:27 -0400
Subject: Re: [users@httpd] mod_fcgid setting content-type header
> > The only approach I've found that works is to
> > stick a header("Content-type: text/css") at the top of my css files,
which
> > is inconvenient to say the least. Anyone have a solution for this?
>
> Most of those *type directives only apply when apache serves a static
> file by that name. If you're generating it from fcgi, you have to
> issue the content-type yourself.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] mod_fcgid setting content-type header
Posted by Eric Covener <co...@gmail.com>.
> The only approach I've found that works is to
> stick a header("Content-type: text/css") at the top of my css files, which
> is inconvenient to say the least. Anyone have a solution for this?
Most of those *type directives only apply when apache serves a static
file by that name. If you're generating it from fcgi, you have to
issue the content-type yourself.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org