Not detecting $_SERVER['HTTP_X_PJAX'] on production (nginx php-fpm) server

144 Views Asked by At

Locally $_SERVER['HTTP_X_PJAX']; exists, but on production it does not exist.

I detect if the request was pjax and add some special logic in the case it is true.

$isPjax = isset($_SERVER['HTTP_X_PJAX']) && $_SERVER['HTTP_X_PJAX'] === 'true';

On the left is local (php 7.4 apache), the right is production (php fpm 7.3.26). Both loaded the pages via pjax. enter image description here

I assume I have to configure nginx to enable HTTP_X_PJAX to be available in the header. I googled around and nothing stuck out to me. Any help is appreciated.

1

There are 1 best solutions below

0
Ritesh Aryal On

It usually does not exist if you are using PHP-FPM (CLI) in your Prod. It basically depends upon the nature of the application.