X-Accel-Redirect In Apache2 - nginx

I'm building a Flask/Apache2 web app that includes large video files that a user must be authenticated to view. I'd like to use Flask to serve the video files after authentication and not having to expose the media directory instead of just the plain HTML video tag that anyone with the URL can access.
I've tried using flask's send_file which works for things like images and thumbnails but large videos take forever to buffer and freeze up.
I see that NGINX has X-Accel-Redirect for the redirection of video files on my server (hidden, not in the web directory) to go to the user through flask but I'm not that sure how to implement this with Apache2.
Running Flask, Apache2, Ubuntu
TLDR:
Basically trying to send large files to the user through flask (not using send_file as this freezes) to enable authentication and not having to expose the whole directory to the internet with the files as I would with the video HTML tag. NGINX has X-Accel-Redirect, what's the apache2 equivalent for use in flask?
Thanks!

Related

Nginx with Nuxt not serving the domain

I am new to Nginx and have been trying to set up server blocks in Nginx, locally on macOS. The purpose is to render Nuxt app when a user requests a certain domain. However, even after spending hours and hours on it, I am not able to identify why I can not hit the domain (here example1256.com) and get the nuxt app content in return.
This is my nginx.conf
etc/hosts (which btw I created myself, hosts file was not there from installation)
directory structure
If I try doing 127.0.0.1:8080, I get the Nuxt content in return. However, hitting the domain always yeilds this:browser: chrome

WordPress - host Uploads directory to remote server via FTP or sFTP

I have 2 servers -
1. Application server - where WordPress application are hosted and
2. Media server - where all media files (like images, pdf, etc.) are hosted
I am trying to upload all images directly via FTP. But to achieve this through FTP connection, I have to upload images on application server's Upload folder, then read all images one by one and then move all images to Media server. Once all images moved to Media server, I need to delete these images from Application server. These process too costly and is not working if multiple images have same name.
Is there any code, by which I can upload all images to Media server via FTP, without storing it to Application server. Please help. Thanks in advance.

Wordpress won't serve js files through reverse proxy

I've got a perfectly functioning wordpress site on Azure AND a main website as different Azure website. I want the main website to be a reverse proxy server so that all the wordpress content is served to the outside world from our main domain.
All the web server jiggering I've done appears to work properly: the browser finds/displays the content and the proxy web server has re-written all the URLs so that 'myblog.azurewebsites.net' is replaced by 'mydomain.com/blog' (I can see that it's all correct when viewing the html page source).
However, there are a few files that the browser can't access, most notably the js files in the wp-includes folder. A 403 Forbidden error is returned.
Why would the original site send the article content but not the js files? Is there something special about the wp-includes folder? Do I need to loosen some permissions on it?
I found this somewhat related discussion, but can't find a way to modify my wp-config.php file so everything works.

Meteor 503 from CollectionFS

I got a 503 when trying to upload using the CollectionFS Filesystem adaptor (only on production, local works fine.)
the response headers show:
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:PUT
Access-Control-Allow-Origin:http://meteor.local
I would like to know what this address is, but I could not find documentation about it.
Few thing that come to mind:
Your static files URL under the web server.
Do you set it to a virtual directory (location) on your web server?
If yes, check your nginx/apache virtual directory directives. Make sure there are correct
Do you handle it in your meteor application?
If you set it to your meteor application, did you set the route for it in your application correctly?
Permission issues between the user that run the web-server, the user that run the meteor application and the user that own the actual folder on the file system

How to implement a secured download system?

What's the best way to implement a download system?
It needs to be integrated with an asp.net application.
I need the following features:
Deliver files larger than 50mb
Only users authorized by an asp.net login page can download
Need to know if the user downloaded the whole file, or part of it
Once the file is downloaded or canceled, the same url will not be available again
It's something similar to rapidshare I believe, but integrated with an asp.net application.
What would you guys suggest?
thanks!
What if you hosted the files on a lighttpd server running modsecdownload, and used your asp.net app to generate the secure urls to the files on that server?
That approach should handle items 1,2 and 4.
Not sure how you could tell from the server side that the download was completed successfully, maybe have some logic that parses the server logs?
You could also use nginx and its X-Accel-Redirect feature. It's simple, and nginx is even more ridiculously fast and lightweight than lighttpd. A common setup at least in the Ruby and Python web world is to run nginx in front of lighttpd or Apache. nginx serves all static media and proxies dynamic request to the web server behind it.

Resources