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:
http://myshop.com/downloads/big_hit.flac
The file is stocked at /path/to/the/flac_files/big_hit.flac
your ecommerce sends an header:
X-Accel-Redirect: /path/to/the/flac_files/big_hit.flac
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:http://nginx.org/en/docs/http/ngx_http_core_module.html#internal
-
It seems Nginx need to be setup in a specific way, such as
https://kovyrin.net/2010/07/24/nginx-fu-x-accel-redirect-remote/
-
@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. -
@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. -
@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.
-
@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.
-
One their dev created this post here : https://forum.cloudron.io/topic/3120/real-hosting-support-needed-nginx-php-apache-postgresql-memcached-nodejs