X-ACCEL/X-SENDFILE Nginx support
I have a custom php webapp that need this feature, would it be possible with cloudron ?
XSendfile in Nginx is called X-Accel-Redirect.
The way X-Accel-Redirect works is that your app/backend sends a
“special” header with the location of the file that is to be served by
Nginx. Usually the application case is for speeding up the delivery of
protected/private files. Let’s say you have a ecommerce site that
sells digital downloads. Then these files will be protected and for
speeding up the delivery your application sends an X-Accel-Redirect
header with the location of the file. Then the file is delivered by
Nginx as a regular static file.
Example: I request to download:
The file is stocked at /path/to/the/flac_files/big_hit.flac
your ecommerce sends an header:
when Nginx sees this he knows that now the file is to be served
directly from the file system as a regular static file. Note that the
real location is hidden from the client.
Note that the real location must be protected from direct access by
the client always, be it from your app, be it from your server, for
example using the internal keyword:
It seems Nginx need to be setup in a specific way, such as
So I'm guessing these instructions need to be set in the Dockerfile ?
@rmdes I haven't used X-Accel before so please take this comment fwiw.
There is already a nginx reverse proxy in front of the app. This means that nginx will make a query back using whatever URL was set in the header. This in turn means that apache (part of your app) will get the request. So, maybe all you have to do is to have a .htaccess that responds to this internal request? You can see if the request it coming (
/internal_redirect) to your apache server from the app logs.
@girish interesting, I'll share this with the dev, thanks a lot !!
@rmdes From what I understood of your app generally, I really suggest you look into building a custom cloudron package for your app, instead of trying this hard to make it work with a customized weird lamp stack app.
If your developers can provide a dockerfile that builds a working container of the app, it would be very easy to port to a cloudron-specific package, I think.
@mehdi This was supposed to be a simple PHP web app but the requirements are not that usual I forwarded both of your comments to the dev, let's see how it goes
One their dev created this post here : https://forum.cloudron.io/topic/3120/real-hosting-support-needed-nginx-php-apache-postgresql-memcached-nodejs