views:

284

answers:

1

I have the following Apache mod_rewrite rule:

RewriteRule ^(.*) http://127.0.0.1:4321/$1 [proxy]

This works great; Apache forwards all requests to the CherryPy server I have running on the same machine.

Unfortunately, I'm having some problems with paths which have a space. If I make a request for /Sites/some%20site/image.png then Apache makes a request to CherryPy for /Sites/some site/image.png which messes up CherryPy.

Is there a way to specify in my RewriteRule that I'd like to re-escape spaces in the URL before forwarding the request to CherryPy?

EDIT: I found a reference to something that might help, but I went ahead and ducked the problem by replacing the spaces with underscores and having CherryPy do a conversion before serving the files.

I'd still like to know a better solution if anyone has one; unfortunately I'm on a deadline and don't have time to muck around with this myself at the moment. I may return to this later and post further updates when I find the time.

+3  A: 

Please see http://tools.cherrypy.org/wiki/ModRewrite#Bewaretheencodingbug for the best known solution.

fumanchu