# Getting Ghost API to redirect properly

**URL:** <https://forum.ghost.org/t/getting-ghost-api-to-redirect-properly/4693>\
**Category:** Developer help\
**Created:** [December 27, 2018, 1:16pm UTC](https://forum.ghost.org/t/getting-ghost-api-to-redirect-properly/4693 "2018-12-27T13:16:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Velizar\_Shulev](https://avatars.discourse-cdn.com/v4/letter/v/9fc348/32.png) [@Velizar\_Shulev](https://forum.ghost.org/u/Velizar_Shulev)\
**Post date:** [December 27, 2018, 1:16pm UTC](https://forum.ghost.org/t/getting-ghost-api-to-redirect-properly/4693/1 "2018-12-27T13:16:40Z")

</div>

Hi, logging in to the Ghost admin doesn’t work for me at the moment and I think it’s because the API server is not redirecting properly.

If I call:  
curl -I https:///ghost/api/v2/admin/session

I get the following:  
HTTP/2 301  
server: nginx/1.11.3  
date: Thu, 27 Dec 2018 13:09:48 GMT  
content-type: text/html  
content-length: 185  
location: http:///ghost/api/v2/admin/session/  
strict-transport-security: max-age=15724800; includeSubDomains; preload

The redirect URL is with HTTP instead of HTTPS, so my browser blocks the request which is why I think login fails.

I am running Ghost 2.9.1 as a Docker container. I have set the url environment variable with the correct protocol (HTTPS). The server is running behind an nginx reverse proxy which is configured with proxy\_set\_header X-Forwarded-Proto https.

Is there some other config I’m missing?

---

<div class="post-metadata">

**Author:** ![Velizar\_Shulev](https://avatars.discourse-cdn.com/v4/letter/v/9fc348/32.png) [@Velizar\_Shulev](https://forum.ghost.org/u/Velizar_Shulev)\
**Post date:** [December 27, 2018, 2:29pm UTC](https://forum.ghost.org/t/getting-ghost-api-to-redirect-properly/4693/2 "2018-12-27T14:29:27Z")

</div>

Turned out issue was due to the Nginx config, not Ghost, sorry for the post!

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [January 2, 2019, 11:02am UTC](https://forum.ghost.org/t/getting-ghost-api-to-redirect-properly/4693/3 "2019-01-02T11:02:52Z")

</div>

Closed on January 2, 2019, 11:02am UTC


