# Detects that the server is redirecting the address request cycle

**URL:** <https://www.ruby-forum.com/t/detects-that-the-server-is-redirecting-the-address-request-cycle/211776>\
**Category:** NGINX\
**Created:** [September 13, 2011, 1:32pm UTC](https://www.ruby-forum.com/t/detects-that-the-server-is-redirecting-the-address-request-cycle/211776 "2011-09-13T13:32:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [September 13, 2011, 1:32pm UTC](https://www.ruby-forum.com/t/detects-that-the-server-is-redirecting-the-address-request-cycle/211776/1 "2011-09-13T13:32:32Z")

</div>

hi all

add " if ($http\_referer ~\* “[www.test.com](http://www.test.com)”) {  
rewrite ^/(.\*)$ [http://www.xxx.com](http://www.xxx.com) permanent;  
}"

open browser 出现 “  
This redirect page is incorrect  
Detects that the server is redirecting the address request cycle“

remove " if ($http\_referer ~\* “[www.test.com](http://www.test.com)”) {  
rewrite ^/(.\*)$ [http://www.xxx.com](http://www.xxx.com) permanent;  
}"  
are normal

nginx server config

server {  
listen 80;  
server\_name [www.xxx.com](http://www.xxx.com);  
index index.htm index.html index.php;  
root /www/xxx;

```
    log_format wwwlogs '$remote_addr - $remote_user [$time_local]

```

“$request” ’  
'$status $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” $http\_x\_forwarded\_for’;  
access\_log /data0/logs/wwwlogs.log;

```
    location ^~ /index.php/mo {
            rewrite ^/(.*)$ http://mo.xxx.com permanent;
    }

   if ($http_referer ~* "www.test.com") {
            rewrite ^/(.*)$ http://www.xxx.com permanent;
    }

    location ~* \.php {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fcgi.conf;
            fastcgi_param REQUEST_URI $fastcgi_script_name;
            fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
fastcgi\_param PATH\_INFO $fastcgi\_script\_name;  
}

```
    location ~* \.(jpg|png|jpeg|bmp|gif|swf|js|css) {
            expires 7d;
    }

    location ~* \.apk$ {
            limit_rate 80k;
    }

rewrite ^/web/soft/index/category/(\d+)/?$ /category/$1 permanent;
rewrite ^/web/allSoft/soft/category/(\d+)/?$ /apk/list/$1

```

permanent;  
rewrite ^/web/allSoft/soft/category/(\d+)/order/download\_count/?$  
/apk/list/$1?order=download\_count permanent;  
rewrite ^/web/allSoft/soft/category/(\d+)/order/release\_time/?$  
/apk/list/$1?order=release\_time permanent;  
rewrite ^/web/soft/show/id/(\d+)/?$ /apk/detail/$1 permanent;  
rewrite ^/web/default/apk/id/(\d+)/?$ /apk/download/$1 permanent;  
rewrite ^/web/allSoft/rec/?$ /apk/recommended permanent;  
rewrite ^/web/search/all/q/(._)/?$ /search?q=$1 permanent;  
rewrite ^/web/rom/index/brand/(\d+)/?$ /rom/brand/$1 permanent;  
rewrite ^/web/rom/index/?$ /rom permanent;  
rewrite ^/web/rom/device/id/(\d+)/?/$ /rom/device/$1 permanent;  
rewrite ^/web/rom/list/category/(._)/device/(\d+)/?$ /rom/list/$1/$2  
permanent;  
rewrite ^/web/rom/show/id/(\d+)/?$ /rom/detail/$1 permanent;  
rewrite ^/web/rom/api/level/(.\*)/?$ /rom/level/$1 permanent;  
rewrite ^/web/rom/download/id/(\d+)/?$ /rom/download/$1 permanent;

Posted at Nginx Forum:

> **[Detects that the server is redirecting the address request cycle](https://forum.nginx.org/read.php?2,215139,215139#msg-215139)**
>
> hi all add " if ($http\_referer ~\* "www.test.com") { rewrite ^/(.\*)$ http://www.xxx.com permanent; }" open browser 出现 “ This redirect page is incorrect Detects that the server i

---

<div class="post-metadata">

**Author:** ![liushaobo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/848f3c/32.png) [@liushaobo](https://www.ruby-forum.com/u/liushaobo)\
**Post date:** [September 13, 2011, 1:36pm UTC](https://www.ruby-forum.com/t/detects-that-the-server-is-redirecting-the-address-request-cycle/211776/2 "2011-09-13T13:36:16Z")

</div>

Hello!

On Tue, Sep 13, 2011 at 07:32:06AM -0400, liushaobo wrote:

> remove " if ($http\_referer ~\* “[www.test.com](http://www.test.com)”) {  
> rewrite ^/(.\*)$ [http://www.xxx.com](http://www.xxx.com) permanent;  
> }"  
> are normal

You’ve asked nginx to do infinite redirect, and you’ve got it.  
It’s not clear what you are asking about.

Maxim D.

---

<div class="post-metadata">

**Author:** ![liushaobo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/848f3c/32.png) [@liushaobo](https://www.ruby-forum.com/u/liushaobo)\
**Post date:** [September 13, 2011, 1:59pm UTC](https://www.ruby-forum.com/t/detects-that-the-server-is-redirecting-the-address-request-cycle/211776/3 "2011-09-13T13:59:09Z")

</div>

在 2011-09-13二的 15:35 +0400，Maxim D.写道：

> > open browser 出现 “
> 
> Maxim D.
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

well,the OP make nginx into DEAD-CYCLE while $Http\_Refer equals the site  
rewrite/redirect to.

i guess that the OP should do something on regex of $Http\_refer.

–  
Best regards,  
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED** )

Using Gmail? Please read this important notice:  
[Gmail — Free Software Foundation — Working together for free software](http://www.fsf.org/campaigns/jstrap/gmail?10073).
