Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

xicond's avatar

TrustXSendfileTypeHeader In Proxy to Octane

I'm using Symfony trustXSendfileTypeHeader to accelerate file transfer in normal php-fpm. But Also I'm in planning to migrate to use octane server, with nginx proxy

Testing the trustXSendfileTypeHeader seems not working properly in proxy mode. How suppose I configure the proxy to avoid pointing the static x-accel header to be proxying back

My base is laradock nginx + php-worker as octane

location /protected-files/ {
    internal;
    alias /var/www/storage/pdf/export/;
}

location / {
    proxy_pass    http://php-upstream;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Sendfile-Type X-Accel-Redirect;
    proxy_set_header X-Accel-Mapping /var/www/storage/pdf/export/=/protected-files/ ;
    proxy_cache_bypass $http_upgrade;
    proxy_pass_request_headers      on;
}
0 likes
0 replies

Please or to participate in this conversation.