Prefixing URL's

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?

Thanks in advance for any guidance.

On 28 Dez 2010 05h12 WET, [email protected] wrote:

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?

Try this: Module ngx_http_core_module

— appa

Hello!

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

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] Module ngx_http_sub_module

Maxim D.

Hi,

On 28/12/2010 07:12, David J. wrote:

I have an app that uses relative URLs

ie: /media/assets/css/style.css
This is not a relative URL, it’s an absolute URL from the base of the
current host.

You need to either use

media/assets/css/style.css

or

/app/media/assets/css/style.css

Marcus.