Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. X-ACCEL/X-SENDFILE Nginx support

X-ACCEL/X-SENDFILE Nginx support

Scheduled Pinned Locked Moved Support
8 Posts 3 Posters 1.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • rmdesR Offline
    rmdesR Offline
    rmdes
    wrote on last edited by
    #1

    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

    source

    1 Reply Last reply
    0
    • rmdesR Offline
      rmdesR Offline
      rmdes
      wrote on last edited by
      #2

      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/
      40734f53-fc25-48dc-a7b4-b6f4f260be21-image.png

      1 Reply Last reply
      0
      • rmdesR Offline
        rmdesR Offline
        rmdes
        wrote on last edited by
        #3

        So I'm guessing these instructions need to be set in the Dockerfile ?

        1 Reply Last reply
        0
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #4

          @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.

          rmdesR 1 Reply Last reply
          1
          • girishG girish

            @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.

            rmdesR Offline
            rmdesR Offline
            rmdes
            wrote on last edited by
            #5

            @girish interesting, I'll share this with the dev, thanks a lot !!๐Ÿ‘

            mehdiM 1 Reply Last reply
            0
            • rmdesR rmdes

              @girish interesting, I'll share this with the dev, thanks a lot !!๐Ÿ‘

              mehdiM Offline
              mehdiM Offline
              mehdi
              App Dev
              wrote on last edited by
              #6

              @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.

              rmdesR 1 Reply Last reply
              1
              • mehdiM mehdi

                @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.

                rmdesR Offline
                rmdesR Offline
                rmdes
                wrote on last edited by
                #7

                @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 ๐Ÿ™‚

                1 Reply Last reply
                0
                • rmdesR Offline
                  rmdesR Offline
                  rmdes
                  wrote on last edited by
                  #8

                  One their dev created this post here : https://forum.cloudron.io/topic/3120/real-hosting-support-needed-nginx-php-apache-postgresql-memcached-nodejs

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Bookmarks
                  • Search