Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Thursday, May 07, 2009

Apache + Passenger + HTTP Basic

Say you've thrown together a simple demo application, thrown it out on the web, and now want to make sure that no one messes with the data before that big client looks checks out your demo and signs that big $$ contract. Being a demo - the quick and dirty way to get this up is to just throw in some HTTP Basic Authentication. With Apache + Passenger the way to do this is to add a Location directive inside your VirtualHost element:



You can configure HTTP Basic in a few different ways, but the above is usually what you are going to want.

Wednesday, January 07, 2009

Apache Tip: Encourage Browsers to Open Documents in the Native Application

Jakob Nielsen says that you shouldn't open "non-web documents" within the browser window. Some of our users had the same complaint and were asking for us to prevent pdf, doc, and other file formats from opening inline within the browser window.

The way to get this to happen is to add a "Content-disposition" header with the value of "Attachment". Of course if you are using Rails send_file or send_data methods you can easily add this header. If, however, the files are being served up directly by your web server then you need to find another way to add this header. If you are using Apache 2 the following directives in your conf file should do the trick: