Prefixing URL's

Maxim Dounin mdounin at mdounin.ru
Tue Dec 28 16:53:05 MSK 2010


Hello!

On Tue, Dec 28, 2010 at 12:12:49AM -0500, David J. wrote:

> I have an app that uses relative URLs
> 
> ie: /media/assets/css/style.css
> 
> in my server config I have
> 
> location /app {
> 
>     #config stuff here.
> }
> 
> When I go to "/app" from a browser the urls are not prefixed with
> "/app" they stay the same ie: "/media/assets/css/style.css"
> 
> But because I mounted the "/app" rather than the root "/" the urls
> are no longer valid.
> 
> "/media/assets/css/style.css" should be "/app/media/assets/css/style.css"
> 
> What options are available to fix this?

By saying "not prefixed" you mean nginx doesn't replace urls in 
your app's response?  It is not supposed to do so.

Some trivial things may be resolved with sub filter module[1], more 
complex cases generally require fixing application.

[1] http://wiki.nginx.org/HttpSubModule

Maxim Dounin



More information about the nginx mailing list