Skip to content

Instantly share code, notes, and snippets.

@cmaujean
Created April 9, 2011 00:02
Show Gist options
  • Save cmaujean/910957 to your computer and use it in GitHub Desktop.
Save cmaujean/910957 to your computer and use it in GitHub Desktop.
apache 2.0.54 proxy and rewrite for example of a setup for proxy to a wordpress blog so it appears to be a seamless part of the enclosing CF6.1 based shopping cart, while running on a different machine.
RewriteEngine On
Options +FollowSymLinks
<Directory /path/to/the/Blog>
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
Redirect /blog http://www.example.com/Blog
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /Blog http://ec2-X-X-X-X.us-west-1.compute.amazonaws.com:2241
ProxyPass /Blog/ http://ec2-X-X-X-X.us-west-1.compute.amazonaws.com:2241/
ProxyPassReverse /Blog http://ec2-X-X-X-X.us-west-1.compute.amazonaws.com:2241
ProxyPassReverse /Blog/ http://ec2-X-X-X-X.us-west-1.compute.amazonaws.com:2241/
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com$1 [R=301]
RedirectMatch ^/admin/(.*) https://www.example.com/admin/$1
RedirectMatch ^/checkout_(.*) https://www.example.com/checkout_$1
RedirectMatch ^/(.*register.*) https://www.example.com/$1
RedirectMatch ^/(.*login.*) https://www.example.com/$1
RedirectMatch ^/(.*processcoupon.*) https://www.example.com/$1
RewriteCond %{REQUEST_URI} \/index\.cfm
RewriteRule ^(.*)$ http://www.example.com [R=301]
# Disable TRACE for McAfee Secure
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
@cmaujean
Copy link
Author

cmaujean commented Apr 9, 2011

This may be quite ugly, and all screwed up (to paraphrase an irc wag), but it does happen to work. If I had my druthers, This monstrosity would be replaced by an all ruby on rails app running on heroku, but monkeys will do obscene things to the pope on live national television before that happens, so here we are. If you have a coherent and proper way to accomplish the same goals, please, by all means, enlighten me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment