# Ghost redirecting to login page using haproxy

**URL:** <https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205>\
**Category:** Developer help\
**Created:** [May 8, 2018, 8:49pm UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205 "2018-05-08T20:49:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zozo/32/574_2.png) [@zozo](https://forum.ghost.org/u/zozo)\
**Post date:** [May 8, 2018, 8:49pm UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/1 "2018-05-08T20:49:28Z")

</div>

Hello,

I am trying to setup a ghost installation with haproxy in front instead of nginx. Everything works however when I try to login I am getting redirrected back to the login page of the ghost installation.

- The url is [https://anytech-rd.cf](https://anytech-rd.cf)

- Using the latest version of ghost

- There are two servers serving content via a public facing haproxy which has the two ghost nodes as a backend.

- I am using the latest version of safari

- the Errors I can see in the console are the following:

```plaintext

NAME: UnauthorizedError
MESSAGE: Access denied.

level:normal

Client credentials were not provided
For information on how to fix this, please read http://api.ghost.org/docs/client-authentication.
UnauthorizedError: Access denied.
    at new UnauthorizedError (/var/www/ghost/versions/1.22.6/node_modules/ghost-ignition/lib/errors/index.js:101:23)
    at authenticateClient (/var/www/ghost/versions/1.22.6/core/server/services/auth/authenticate.js:40:25)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/layer.js:95:5)
    at /var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:281:22
    at param (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:354:14)
    at param (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:410:3)
    at next (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:174:3)
    at router (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:317:13)
    at /var/www/ghost/versions/1.22.6/node_modules/express/lib/router/index.js:284:7

```

- have a production ghost installed as a backend for haproxy.

---

<div class="post-metadata">

**Author:** ![zozo](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zozo/32/574_2.png) [@zozo](https://forum.ghost.org/u/zozo)\
**Post date:** [May 8, 2018, 9:31pm UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/2 "2018-05-08T21:31:14Z")

</div>

Update: I have tried to connect using firefox and the redirrect is not there. I can login correctly using it.

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [May 9, 2018, 10:31am UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/3 "2018-05-09T10:31:18Z")

</div>

> [@zozo](#):
>
> There are two servers serving content via a public facing haproxy which has the two ghost nodes as a backend.

This won’t work well, we warn against clustered/load-balanced setups [in the docs](https://docs.ghost.org/docs/install). There’s some more details in [this topic](https://forum.ghost.org/t/what-size-server-do-you-all-use/916/26) and a wishlist topic for adding [an internal cache adapter](https://forum.ghost.org/t/external-in-memory-cache-option/1140/2) which would open up cluster support by externalising the current in-memory caches.

I would suggest using a single instance of Ghost and testing without haproxy. If that works then add the haproxy back in and test again.

Sharing your haproxy config will also help anyone spot any problems. The login issue isn’t reproducible with Safari on standard installs with nginx as the reverse proxy so it sounds like something unique to your environment.

---

<div class="post-metadata">

**Author:** ![zozo](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zozo/32/574_2.png) [@zozo](https://forum.ghost.org/u/zozo)\
**Post date:** [May 9, 2018, 11:00am UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/4 "2018-05-09T11:00:16Z")

</div>

I have come to the conclusion that the issue is due to safari. If I browse it using firefox then it works perfectly.

Regards,  
Peter

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [May 9, 2018, 11:13am UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/5 "2018-05-09T11:13:21Z")

</div>

@zozo did you see this part of my reply?

> [@Kevin](#):
>
> The login issue isn’t reproducible with Safari on standard installs using nginx as the reverse proxy so it sounds like something unique to your environment.

If you don’t want to dig into it further and are happy to use a browser that’s working for your setup then 👍 I wouldn’t say that this is a bug in Ghost however as it’s not reproducible with the standard setups.

---

<div class="post-metadata">

**Author:** ![zozo](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zozo/32/574_2.png) [@zozo](https://forum.ghost.org/u/zozo)\
**Post date:** [May 9, 2018, 11:17am UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/6 "2018-05-09T11:17:34Z")

</div>

I am happy with using a different browser. However I think I’ve seen the same issue logged about 5-6 days a go for internet explorer and safari. Thanks anyway

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [May 23, 2018, 11:18am UTC](https://forum.ghost.org/t/ghost-redirecting-to-login-page-using-haproxy/1205/7 "2018-05-23T11:18:55Z")

</div>

Closed on May 23, 2018, 11:18am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
