I have nginx setup as a proxy in front of APACHE, which in turn talks to PHP-FPM.

It turns out, nginx is cutting out (or better to say not passing through) headers that are set directly in PHP via the header('foo: bar') command.

Namely I see the following picture:

PHP I set the following headers: - cache-control - pragma - expires

And I see these if I open the page not through the nginx proxy, but directly through apache.

Now, when I open the page through nginx > all of the above are missing, and cache-control is totally replaced :/

I have the following extra directives in the nginx config, aiming to cache all images and static files for at least 30 days:

tcp_nopush on;
tcp_nodelay on;
access_log off;
expires       30d;
keepalive_timeout 30;
keepalive_requests 1000;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;

whatever I try does not work > seems like nginx is generally ignoring all headers coming its way from apache. Is there any way around this?

  • Why are you using Apache at all in this scenario? It is redundant. – Michael Hampton May 23 at 14:50
  • the application uses mod_rewrite heavily and we do not have the resources to port it yet – clops May 27 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.