Nginx 1.6.2 - Redirect users base on 4 digits number provide

Styopa Semenukha semenukha at gmail.com
Tue Oct 7 02:20:01 UTC 2014


On Monday, October 06, 2014 12:24:35 PM mottycruz wrote:
> Thanks for your help Styopa, 
> 
> I was able to find modules installed on our current proxy with the following
> command, because we have a customize module. 
> 
> :~# /usr/local/nginx/sbin/nginx  -V
> nginx version: nginx/0.7.67
> built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) 
> TLS SNI support enabled
> configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module
> --add-module=/home/ngx_http_cust_app_version_routing
> 
> I tried to redirect base on URL
> 
> for instance I tried: 
> Redirect ^/app2$ http://app2.server2.com;
> 
> but does not seem to be working, I can't find much in the logs. do you have
> any suggestions? 
> 
> Thanks, 
> -Motty
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,253708,253792#msg-253792
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Hello Motty,

I'm a little bit confused by your question. If your goal is to serve different URLs by different backends, the config will look like this:

location = /app2 {
# this will strip "/app2" from the request to the backend
# e.g. user request of: /app2/index.do?foo=bar
# will be routed to app2 backend as:
# /index.do?foo=bar
proxy_pass http://app2.server2.com/;
}

If your goal is to return HTTP 301 permanent redirect, it will be:
location = /app2 {
return 301 $scheme://app2.server2.com/;
}

Please be sure to read the following info (it's pretty short actually):
http://nginx.org/r/location
http://nginx.org/r/proxy_pass

Unfortunately, I'm not familiar with 3rd-party modules, so I cannot advise on them.
-- 
Sincerely yours,
Styopa Semenukha.



More information about the nginx mailing list