# Phantom redirects in Log file

**URL:** <https://www.ruby-forum.com/t/phantom-redirects-in-log-file/221170>\
**Category:** NGINX\
**Created:** [July 3, 2012, 2:45pm UTC](https://www.ruby-forum.com/t/phantom-redirects-in-log-file/221170 "2012-07-03T14:45:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 3, 2012, 2:45pm UTC](https://www.ruby-forum.com/t/phantom-redirects-in-log-file/221170/1 "2012-07-03T14:45:44Z")

</div>

Hello,

I am hosting multiple domains on a vserver, and I observe some  
cross-domains redirects at the end of a visit:

xxx.xxx.211.94] / IND - Bangalore / domain1.info / -  
[03/Jul/2012:13:15:31 +0200] “GET /favicon.ico HTTP/1.1” 200 0 /  
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like  
Gecko) Chrome/20.0.1132.47 Safari/536.11  
xxx.xxx.211.94] / IND - Bangalore / [domain2.com](http://domain2.com) / -  
[03/Jul/2012:13:15:41 +0200] “-” 400 0 / -

Anyone knows why there is redirect at the end of the visiti in the  
log? What’s the effect for the visitor on the other end?

Here are some more details:

/etc/nginx/sites-enabled  
lrwxrwxrwx 1 www-data root 30 2012-02-28 18:57 [domain2.com](http://domain2.com) →   
…/sites-available/domain2.com  
lrwxrwxrwx 1 root root 29 2012-06-20 23:20 domain1.info →   
…/sites-available/domain1.info

upstream unicorn\_domain1 {  
server unix:/tmp/unicorn\_domain1.todo.sock fail\_timeout=0;  
}

server {  
listen 80;  
server\_name www.domain1.info;  
rewrite ^/(.\*) [http://domain1.info](http://domain1.info) permanent;  
}

server {  
listen 80;  
server\_name domain1.info;

```
        root /home/domain1/development/current/public;

        error_page 502 /502.html;

       try_files $uri/index.html $uri @unicorn_domain1;

```

location @unicorn\_domain1 {  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header Host $http\_host;  
proxy\_redirect off;  
proxy\_pass http://unicorn\_domain1;  
}

```
       client_max_body_size 4G;
       keepalive_timeout 5;
       error_page 500 502 503 504 /500.html;

        location ~* \.(ico|js|css|gif|jpe?g|png)(\?[0-9]+)?$ {
            expires max;
            break;
        }

        if (-f $request_filename/index.html) {
            rewrite (.*) $1/index.html break;
        }

        if (-f $request_filename.html) {
            rewrite (.*) $1.html break;
        }

```

}

[domain2.com](http://domain2.com)  
server {  
listen 80;  
server\_name [domain2.com](http://domain2.com);

```
        root /home/domain2/development/current/public;

        error_page 502 /502.html;

        location ~* \.(ico|js|css|gif|jpe?g|png)(\?[0-9]+)?$ {
            expires max;
            break;
        }

        if (-f $request_filename/index.html) {
            rewrite (.*) $1/index.html break;
        }

        if (-f $request_filename.html) {
            rewrite (.*) $1.html break;
        }

```

}

---

<div class="post-metadata">

**Author:** ![p\_morrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@p\_morrow](https://www.ruby-forum.com/u/p_morrow)\
**Post date:** [July 3, 2012, 3:03pm UTC](https://www.ruby-forum.com/t/phantom-redirects-in-log-file/221170/2 "2012-07-03T15:03:52Z")

</div>

Hello!

On Tue, Jul 03, 2012 at 02:45:21PM +0200, Patrick M. wrote:

> [03/Jul/2012:13:15:41 +0200] “-” 400 0 / -
> 
> Anyone knows why there is redirect at the end of the visiti in the  
> log? What’s the effect for the visitor on the other end?

Why do you think it’s redirect? Most likely “[domain2.com](http://domain2.com)” is just  
a default server on the listen socket used, and an invalid request  
(or, rather, a connection without a request at all) was logged in  
it’s context.

See here for more details:

> **[How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![p\_morrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/73ab20/32.png) [@p\_morrow](https://www.ruby-forum.com/u/p_morrow)\
**Post date:** [July 3, 2012, 3:21pm UTC](https://www.ruby-forum.com/t/phantom-redirects-in-log-file/221170/3 "2012-07-03T15:21:59Z")

</div>

On Tue, Jul 3, 2012 at 3:03 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Why do you think it’s redirect? Most likely “[domain2.com](http://domain2.com)” is just  
> a default server on the listen socket used, and an invalid request  
> (or, rather, a connection without a request at all) was logged in  
> it’s context.
> 
> See here for more details:  
> [How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html)

Thanks, that helps in my understanding! I’ll test the influence of  
having the default\_server set to domain1.  
Btw, is there some help / tools to see the difference between a  
connection and an HTTP request?
