You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Oliver Baran <ob...@gmail.com> on 2016/08/22 16:14:04 UTC

[users@httpd] mod_headers not sending headers when file is parsed with PHP fpm

Hello,

I have a problem with Apache mod_headers and PHP fpm (fastcgi).
If I write a custom header directly in the vhost configuration it is send
to the client, even if the request it is a PHP file. But when I write the
header in the directory section of that vhost configuration or in a
.htaccess file, the custom header is not send to the client if the
requested file is parsed through PHP. If I request a .txt file the header
is send to the client. It does not matter if I write `Header always set
MyCustomHeader "test"` or `Header set MyCustomHeader "test"`

My Versions:

/usr/sbin/apache2 -v
Server version: Apache/2.2.22 (Debian)
Server built:   Jul 20 2016 05:06:20

/usr/sbin/php5-fpm -v
PHP 5.6.24-1~dotdeb+7.1 (fpm-fcgi) (built: Jul 21 2016 23:28:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend
Technologies

Has someone a idea how to fix this?

Thanks
Oliver

Re: [users@httpd] mod_headers not sending headers when file is parsed with PHP fpm

Posted by Eric Covener <co...@gmail.com>.
On Mon, Aug 22, 2016 at 12:14 PM, Oliver Baran <ob...@gmail.com> wrote:
> Hello,
>
> I have a problem with Apache mod_headers and PHP fpm (fastcgi).
> If I write a custom header directly in the vhost configuration it is send to
> the client, even if the request it is a PHP file. But when I write the
> header in the directory section of that vhost configuration or in a
> .htaccess file, the custom header is not send to the client if the requested
> file is parsed through PHP. If I request a .txt file the header is send to
> the client. It does not matter if I write `Header always set MyCustomHeader
> "test"` or `Header set MyCustomHeader "test"`

How do you configure Apache to talk to php-fpm? If you use
mod_proxy_fcgi, httpd is generally not aware of any directory used to
satisfy the request -- it's proxying the URL to FPM.

The exception is when you use the SetHandler configuration method of
mod_proxy_fcgi.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org