Rerouting based on content-type of request

2015-08-06 Thread sudharshanr
I'm having a reverse-proxied Nginx server. I wanted to know if it is possible to redirect the request in Nginx based on the content-type of the request? Right now, I'm checking the URL for a keyword, and based on that, I redirect the request. So it is something like this: location ~*/(keyword){

Re: Fetching a string by parsing URL

2015-07-23 Thread sudharshanr
For some reason, I'm getting it as null. This is my config file: map $uri $last_path { ~*/(?[^/]+)/?$ $pathname; } server { listen 80; root /basefolder; error_page 500 501 502 503 504 = /error5x.html?name=$arg_name&path=$last_path; location ~*/error5x.html? { alias /Desktop/error5x.html; } loc

Re: Fetching a string by parsing URL

2015-07-23 Thread sudharshanr
For some reason, I'm getting it as null. This is my config file: map $uri $last_path { ~*/(?[^/]+)/?$ $pathname; } server { listen 80; root /basefolder; error_page 500 501 502 503 504 = /error5x.html?name=$arg_name&path=$last_path; location ~*/error5x.html? { alias /Desktop/error5x.html; } loc

Re: Fetching a string by parsing URL

2015-07-22 Thread sudharshanr
For some reason, I'm getting it as null. This is my config file: map $uri $last_path { ~*/(?[^/]+)/?$ $pathname; } server { listen 80; root /basefolder; error_page 500 501 502 503 504 = /error5x.html?name=$arg_name&path=$last_path; location ~*/error5x.html? { al

Re: Fetching a string by parsing URL

2015-07-22 Thread sudharshanr
I think I need to rephrase my question. Right now, my nginx.conf looks like this: location ~*/path1/{ if (-f $document_root/error503.html) { return 503; } } error_page 503 ?arg1=$arg_queryparam1&arg2= As you can see, if there is a 503 error, then I return a static file. The arguments to the stat

Re: Fetching a string by parsing URL

2015-07-21 Thread sudharshanr
Edho Arief: Thanks, but I think I need to rephrase my question. Right now, my nginx.conf looks like this: location ~*/path1/{ if (-f $document_root/error503.html) { return 503; } } error_page 5

Fetching a string by parsing URL

2015-07-21 Thread sudharshanr
I have a web server sitting behind Nginx. If there is an error, then I want to fetch some information from the url and pass it on to a static file as parameters. I have configured Nginx to fetch the query parameters from the url using $arg_param_name. However, I also need to fetch a String from t

Re: Using the access_log if directive in 1.6.x

2014-12-11 Thread sudharshanr
Valentin V. Bartenev Wrote: --- > On Thursday 11 December 2014 00:33:24 sudharshanr wrote: > > Hi, > > > > I'm using nginx 1.6.2 on Amazon ec2 linux server. The problem I'm > having is > > that all my

Using the access_log if directive in 1.6.x

2014-12-10 Thread sudharshanr
Hi, I'm using nginx 1.6.2 on Amazon ec2 linux server. The problem I'm having is that all my 404 errors are going to my access.log. I want them to be redirected to error.log instead. I saw on other forums that with nginx 1.7+, I can use the if directive of access_log to do something like: map