Created
December 21, 2012 01:23
-
-
Save RJ/4350070 to your computer and use it in GitHub Desktop.
Apache2 conf snippit to proxy and rewrite URLs for graphite. https://graphite-admin.example.com ---> https://admin.example.com/graphite Used on a dashboard page that includes graphs from various other domains, and it was annoying typing basic-auth passwords all the time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSLProxyEngine on | |
# Graphite URLs that are buried in JS that we can't easily rewrite, we issue an http redirect | |
# - /content/js/ext/resources/images/default/s.gif | |
# - /render | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^admin\.example\.com [NC] | |
RewriteRule ^/content/js/ext/resources/images/default/s.gif https://graphite-admin.example.com/content/js/ext/resources/images/default/s.gif [L,R] | |
RewriteRule ^/render https://graphite-admin.example.com/render [L,R] | |
<Location /graphite> | |
ProxyPass https://graphite-admin.example.com | |
ProxyPassReverse https://graphite-admin.example.com | |
SetOutputFilter INFLATE;proxy-html;DEFLATE | |
# Don't mess with anchors | |
ProxyHTMLUrlMap ^#(.*) #$1 [R,L] | |
# Or with relative urls | |
ProxyHTMLUrlMap ^([^/].*) $1 [R,L] | |
ProxyHTMLUrlMap ^https://grapite-admin.example.com/(.*) https://admin.example.com/grapite/$1 [R,L] | |
ProxyHTMLUrlMap (.*) https://admin.example.com/graphite/$1 R | |
</Location> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment