# Weird problem with redirects

**URL:** <https://www.ruby-forum.com/t/weird-problem-with-redirects/244948>\
**Category:** NGINX\
**Created:** [July 15, 2016, 11:58pm UTC](https://www.ruby-forum.com/t/weird-problem-with-redirects/244948 "2016-07-15T23:58:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 15, 2016, 11:58pm UTC](https://www.ruby-forum.com/t/weird-problem-with-redirects/244948/1 "2016-07-15T23:58:40Z")

</div>

Hello,

I have a weird problem that suddenly appeared on a client’s website  
yesterday. We have a redirection from non www to www and sometimes the  
redirection sends somewhere else:

[root@genious33 nginx-1.11.2]# curl -IL -H “host: [hespress.com](http://hespress.com)” x.x.x.x  
HTTP/1.1 301 Moved Permanently  
Server: nginx/1.11.2  
Date: Fri, 15 Jul 2016 21:54:06 GMT  
Content-Type: text/html  
Content-Length: 185  
Connection: keep-alive  
Location: [http://1755118213](http://1755118213)  
.com/  
dbg-redirect: nginx

HTTP/1.1 302 Found  
Server: nginx/1.2.1  
Date: Fri, 15 Jul 2016 21:52:37 GMT  
Content-Type: text/html; charset=iso-8859-1  
Connection: keep-alive  
Set-Cookie: orgje=JbgbADQAAgABACVbiVf\_\_yVbiVdAAAEAAAAlW4lXAA–;  
expires=Sat, 15-Jul-2017 21:52:37 GMT; path=/; [domain=traffsell.com](http://domain=traffsell.com)  
Location: [http://m.xxx.com/](http://m.xxx.com/)

HTTP/1.1 200 OK  
Date: Fri, 15 Jul 2016 21:52:37 GMT  
Content-Type: text/html; charset=UTF-8  
Connection: keep-alive  
Set-Cookie: \_\_cfduid=d5624eb7a789e21f082873681ec36a41b1468619557;  
expires=Sat, 15-Jul-17 21:52:37 GMT; path=/; [domain=.hibapress.com](http://domain=.hibapress.com);  
HttpOnly  
X-Powered-By: PHP/5.3.27  
X-LiteSpeed-Cache: hit  
Vary: Accept-Encoding  
X-Turbo-Charged-By: LiteSpeed  
Server: cloudflare-nginx  
CF-RAY: 2c307148667c3f77-YUL

Sometimes it acts as it should sometimes it redirect somewhere else

If you have any clue about what’s happening, do help me 🙂

Thank you,  
Hamza

---

<div class="post-metadata">

**Author:** ![Hamza\_Aboulfeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/45deac/32.png) [@Hamza\_Aboulfeth](https://www.ruby-forum.com/u/Hamza_Aboulfeth)\
**Post date:** [July 16, 2016, 9:48am UTC](https://www.ruby-forum.com/t/weird-problem-with-redirects/244948/2 "2016-07-16T09:48:04Z")

</div>

On Fri, Jul 15, 2016 at 10:58:07PM +0100, Hamza Aboulfeth wrote:

Hi there,

> I have a weird problem that suddenly appeared on a client’s website  
> yesterday. We have a redirection from non www to www and sometimes  
> the redirection sends somewhere else:
> 
> [root@genious33 nginx-1.11.2]# curl -IL -H “host: [hespress.com](http://hespress.com)” x.x.x.x

If that x.x.x.x is enough to make sure that this request gets to your  
nginx, then your nginx config is probably involved.

If this only started yesterday, then changes since yesterday (or since  
your nginx was last restarted before yesterday) are probably most  
interesting.

And as a very long shot: if you can “tcpdump” to see that nginx is  
sending  
one thing, but the client is receiving something else, then you’ll want  
to look outside nginx at something else interfering with the traffic.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
