The question on how to configure an apache instance so it can reverse
proxy a SqueezeCenter server has come up here a couple of times. A
solution that worked with the new interface has not been offered on
this forum AFAIK. After some experimenting I managed to make it work,
and thought I would share this with you.

Basically just  adding ProxyPass directives to the apache config
doesn't work. This is because a lot of the javascripts use absolute
paths. A rewrite rule that uses the fact that all requests contain a
cookie is the solution. This is how it looks like:


Code:
--------------------
    
  95 # Stuff to get the SqueezeCenter interface working.
  96 ProxyRequests Off
  97 
  98 <Proxy  http://localhost:9000/*>
  99     Order deny,allow
  100     Allow from all
  101 </Proxy>
  102 
  103 RewriteEngine On
  104 RewriteLog  /var/log/apache2/ssl_rewrites.log
  105 RewriteLogLevel 1
  106 
  107 RewriteCond %{HTTP_COOKIE} SqueezeCenter
  108 RewriteCond $1             !^/SqueezeCenter
  109 RewriteRule (.*)            http://localhost:9000$1 [P,E=SC:true]
  110 
  111 RequestHeader set Referer http://localhost:9000/ env=SC
  112 
  113 
  114 <Location /SqueezeCenter>
  115         ProxyPass http://localhost:9000
  116         ProxyPassReverse http://localhost:9000
  117         SetOutputFilter proxy-html
  118         ProxyHTMLURLMap / /SqueezeCenter/
  119         RequestHeader set Referer http://localhost:9000/
  120         Order deny,allow
  121         Allow from all
  122 </Location>
  
  
  
--------------------


The RewriteRule at line 109 captures the whole URL and proxies it to my
squeezecenter instance, but only if the squeezecenter cookie is present
(line 107), and the URL doesn't already start with SqueezeCenter (line
108)

Lines starting with SqueezeCenter get proxied to my squeezecenter
instance by the block starting with lien 114. The referrer is reset to
localhost to make authentication work properly, and lines 110 etc. make
sure only authenticated users can get to the interface from outside. The
whole is part of my ssl virtual host config. (and is password
protected)

Works like a charm.


-- 
Krist
------------------------------------------------------------------------
Krist's Profile: http://forums.slimdevices.com/member.php?userid=2590
View this thread: http://forums.slimdevices.com/showthread.php?t=55475

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix

Reply via email to