The dirt-simple URL shortener at brk.mn
JavaScript Ruby CoffeeScript
Pull request Compare This branch is 5 commits ahead, 10 commits behind berkmancenter:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
doc
lib
log
public
script
test
vendor
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README.rdoc
Rakefile
config.ru

README.rdoc

brkmn

A dirt-simple URL shortener.

Links

Deployment

This app assumes apache- (or nginx-) level authentication. We're using apache ldap auth to integrate with our ActiveDirectory server and a set of rewrite rules to ensure user credentials are NEVER passed over non-HTTPs connections. The virtualhost containers look like:

<VirtualHost *:80>
       ServerName example.com
       DocumentRoot /your/railsroot/public
       RewriteEngine On
       RewriteRule ^/$ https://example.com/ [R=302,L]
       RewriteRule ^/(url|user|metric|redirector|preview) https://example.com/$1 [R=302,L]
</VirtualHost>

<VirtualHost *:443>
       ServerName example.com
       DocumentRoot /your/railsroot/public
       SSLEngine On
       # SSL cert / key config stuff here.

       <LocationMatch "^/url|user|metric|redirector|preview">
               # Your auth config here.
       </LocationMatch>
</VirtualHost>

This sets up the app so that access to “/” redirects you to an HTTPS connection that'll attempt authentication. Shortened URLs are available via http:// or https://, authenticated or not.

You can use any apache-level authentication module in the LocationMatch container above, even good ol' htpasswd basic auth.

Contributors

  • Dan Collis-Puro: djcp@cyber.law.harvard.edu

License

brkmn is licensed under the terms of Rails 3.2 itself - the MIT license: www.opensource.org/licenses/mit-license.php

Copyright

2012 President and Fellows of Harvard College