Help for nginx proxy pass rule

Roni Baby roni at citrusinformatics.com
Thu Apr 7 04:20:06 UTC 2016


Perfect fix... Able to solve my issues.Thanks Francis

The issue was, I configured these location blocks already in my config file

location ~* ^.+\.(jpg|jpeg|gif|css|png|ico|zip|xspf|swf|ttf|woff|js)$ { for
serving static files directly. 

It was over ride the location rule that I used

It started to work my location rule changed it like this as per your
recommendation

location ^~ /static {

Thanks a Lot
Roni Baby




-----Original Message-----
From: Nginx [mailto:nginx-bounces at nginx.org] On Behalf Of Francis Daly
Sent: 07 April 2016 03:17
To: nginx at nginx.org
Subject: Re: Help for Nginx proxy pass rule

On Wed, Apr 06, 2016 at 06:58:07PM +0530, Roni Baby wrote:

Hi there,

> Yes the destination Url [https://www.xys.org/static/js/widget.js] is 
> working perfectly alone Why it tried locally? I used proxypass rule 
> for it. If I wanted to do anything to enable proxy capability in my 
> Nginx?

Read http://nginx.org/r/location

Then do something like

  grep location your.conf

to see which location{} blocks you have defined.

Which one of those locations will nginx use to handle this request?

The error log suggests that this request is handled in a location that is
not the one that you showed -- perhaps one defined as something like

  location ~ js$ {

Possibly changing your

> location /static {

to

  location ^~ /static {

will make it work the way you want. That would tell nginx to choose it
instead of any regex one, for this request.


Separate from that: for the proxy_pass directive, you could probably drop
the "/static" part of the argument since it matches the request prefix.

But until the proxy_pass is actually used, changing it will make no
difference.

	f
-- 
Francis Daly        francis at daoine.org

_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list