ralfonso / theory

Python web based MPD client with a pretty face and some ajax where it makes sense
http://theory.steelbreeze.org/
MIT License
34 stars 12 forks source link

PATH issue with mod_proxy / mod_rewrite #2

Open neoice opened 14 years ago

neoice commented 14 years ago

so as written, theory assumes that it will always operate as its own port with its own root (/). however, if you try and include it as part of another hierarchy, you get PATH-related breakage. for example, I run theory on an internal server and want to access it from an external web server using apache2's mod_rewrite like so:

RewriteRule ^/mpd/(.*) http://192.168.10.1:9099/$1 [P]

now when theory renders, it looks for /js, which may not actually exist. I think this can mostly be fixed by removing the preceding slash from all the paths, replacing it with ./ or defining an internal PATH variable so we can define the root at will. I'd be happy to knock out a patch for you. do you a have a preference on how to do this? or do you even want this? I can just fork and maintain a separate patch for my bizarre edge-case setup :D

ralfonso commented 14 years ago

I've wanted to do this for a while, but the core javascript methods use hard-coded paths. It shouldn't be too much of a problem, but I just haven't taken the time to look at it.

neoice commented 14 years ago

"core" as in stuff you wrote or JQuery? I took a poke at it last night and it did look like a path change would be required in almost every file.

ralfonso commented 14 years ago

Stuff I wrote. I didn't worry too much about hard-coding everything when I wrote it because it started out being for personal-use only and I was happy to have a standalone server. I still want to do it, but figuring out a good way to rewrite all of the paths in js/theory.js will be a challenge.

neoice commented 14 years ago

is this still something you're interested in? between work, college and college application season, I've kinda stopped coding anything :/

neoice commented 13 years ago

I finally got off my ass and worked on this. I'll send a pull request. it touches a ton of lines, but they're all pretty trivial, mostly turning "/" into "./" and the occasional "../"

it's been tested by using both the proxy and non-proxy interfaces at the same time and looking for 404/500 errors with Firebug. as far as I can tell, it "works", minus a few places in jquery-ui.

currently, the URL prefix is hardcoded into the dev and server INIs. I'm not sure how to change that if it's required.

next project is to create a skeleton for running the server through mod_wsgi.

edit: hit the wrong button, but it can probably be closed.