How in nginx to determine that the request is performed via ssi include?
example of nginx configuration file:

server { ... ssi on; location ~* \.php$ { ... fastcgi_param REQUEST_SSI <здесь я присвою значение 1, если запрос выполняется через ssi include> } } 

HTML:
<!--#include virtual="/header.php"-->

    1 answer 1

    from the documentation :

    The ngx_http_ssi_module module is a filter that handles server side inclusions (SSI) commands in the responses that pass through it.

    ssi support ( server side includes ) you have already included above. the response from the backend will be returned - nginx will pass it through the filter before returning “upward”.

    if you need a backend to notify that nginx will process ssi commands - notify. Give one variable, for example. the main thing is for the backend to understand this.


    and to distinguish include virtual, you can add the necessary parameter to the url . eg:

     <!--#include virtual="header.php?ssi=on"--> 
    • See, after the response to the main request from the backend came, nginx again sends a request to the backend /header.php according to the instructions that came in the answer <!--#include virtual="header.php"--> . So, it is in this request that the flag must be sent to the backend. Here's how to do it? - ilmir abdulmanov
    • @ilmirabdulmanov, added the answer. - aleksandr barakin
    • Yes) I do it with the parameter for now, but I don’t want to drag this parameter everywhere. And it is not reliable. Its (parameter) can be forgotten by mistake, in which case we get infinite recursion and the request goes away to itself. But if I get $ _SERVER ['MY_FASTSGI_PARAM_SSI_ON'] on the backend, then this immediately solves my problem. I am in the backend, having received such a flag just send a request to another route that is designed to handle these requests. Here's the google for the third hour, nothing yet: ( - ilmir abdulmanov
    • @ilmirabdulmanov, you need to search not in "Google", but in the source code of the program. However, I am sure that there is simply no such undocumented opportunity. - aleksandr barakin
    • @ilmirabdulmanov, you can write yourself. you are a programmer, and the program is not proprietary at all. - aleksandr barakin