# HTTP redirect backend error

**URL:** <https://discourse.haproxy.org/t/http-redirect-backend-error/2975>\
**Category:** Help!\
**Created:** [September 10, 2018, 2:08pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975 "2018-09-10T14:08:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![renato.souza](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/renato.souza/32/606_2.png) [@renato.souza](https://discourse.haproxy.org/u/renato.souza)\
**Post date:** [September 10, 2018, 2:08pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975/1 "2018-09-10T14:08:23Z")

</div>

Hi Dudes!

I´m starting with the HAProxy and I found my first problem. I have a site wich in a direct access everything goes well, but when I try to access through HAProxy, some images isn´t showed.

The site use HTTP redirects,as we can see in logs with the 302 HTTPS response code. Is this the reason?

Sep 10 10:59:10 localhost haproxy[641]: xxx.xxx.xxx.xxx:6999 [10/Sep/2018:10:59:10.000] https-in~ sisjur\_servers/sisjur01 0/0/3/15/18 **302** 510 - - ---- 2/2/1/1/0 0/0 “GET /SISDPVATJUR/App\_Themes/img/Msg\_erro.jpg HTTP/1.1”  
Sep 10 10:59:10 localhost haproxy[641]: xxx.xxx.xxx.xxx:7000 [10/Sep/2018:10:59:10.017] https-in~ sisjur\_servers/sisjur01 0/0/2/13/15 **302** 510 - - ---- 2/2/0/0/0 0/0 “GET /SISDPVATJUR/App\_Themes/img/pbar-ani.gif HTTP/1.1”

What can I do to solve this problem?

Thanks in advance!  
Renato Souza

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [September 10, 2018, 3:09pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975/2 "2018-09-10T15:09:05Z")

</div>

Understand where that request is pointing to, and check why that destination fails. Also consider that your backend server may redirect forever if it doesn’t like something about the request from haproxy (for example: it may try to redirect to https, while haproxy only talks to the backend server on port 80).

Understand why and where to your application redirects is crucial to solving this problem, as it is not really a haproxy problem.

---

<div class="post-metadata">

**Author:** ![renato.souza](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/renato.souza/32/606_2.png) [@renato.souza](https://discourse.haproxy.org/u/renato.souza)\
**Post date:** [September 12, 2018, 1:45pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975/3 "2018-09-12T13:45:34Z")

</div>

Sadly the application has many redirect and developers can’t track everything now. I’ll try another solution.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [September 12, 2018, 5:52pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975/4 "2018-09-12T17:52:19Z")

</div>

They may have many redirects and can’t disable them, but when you understand why the redirect happens, you may be able to do something about it with haproxy.

For example, when the redirect is to SSL because the application doesn’t understand that it may already be on SSL, setting the `X-Forwarded-Proto` can help your application.

Or when the application expects a different host header in the requests, you can rewrite it so that the application is happy.

Understanding why the redirect happens is necessary to evaluate the solutions, it doesn’t mean your application has to change.

---

<div class="post-metadata">

**Author:** ![renato.souza](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/renato.souza/32/606_2.png) [@renato.souza](https://discourse.haproxy.org/u/renato.souza)\
**Post date:** [November 29, 2018, 7:10pm UTC](https://discourse.haproxy.org/t/http-redirect-backend-error/2975/5 "2018-11-29T19:10:53Z")

</div>

Make sense, I´ll try! 🙂

Thanks again!
