# Allow access api form localhost

**URL:** <https://forum.ghost.org/t/allow-access-api-form-localhost/7878>\
**Category:** Developer help\
**Created:** [June 21, 2019, 11:08am UTC](https://forum.ghost.org/t/allow-access-api-form-localhost/7878 "2019-06-21T11:08:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huangyanxiong01](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/huangyanxiong01/32/3853_2.png) [@huangyanxiong01](https://forum.ghost.org/u/huangyanxiong01)\
**Post date:** [June 21, 2019, 11:08am UTC](https://forum.ghost.org/t/allow-access-api-form-localhost/7878/1 "2019-06-21T11:08:07Z")

</div>

[root@bw-ss2 blog-and-tools]# curl -vv [http://127.0.0.1:2368/ghost/api/v2/content/settings/?key=xxxxxxxxxaaaaa](http://127.0.0.1:2368/ghost/api/v2/content/settings/?key=xxxxxxxxxaaaaa)

- About to connect() to 127.0.0.1 port 2368 (#0)
- Trying 127.0.0.1…
- Connected to 127.0.0.1 (127.0.0.1) port 2368 (#0)

> GET /ghost/api/v2/content/settings/?key=assxxxxxxxxxxxxxxxxa HTTP/1.1  
> User-Agent: curl/7.29.0  
> Host: 127.0.0.1:2368  
> Accept: _/_

\< HTTP/1.1 301 Moved Permanently  
\< X-Powered-By: Express  
\< Cache-Control: public, max-age=31536000  
\< Access-Control-Allow-Origin: \*  
\< Location: [httwww.myfreax.com/ghost/api/v2/content/settings/?key=asdddwwww](http://httwww.myfreax.com/ghost/api/v2/content/settings/?key=asdddwwww)  
\< Vary: Accept, Accept-Encoding  
\< Content-Type: text/plain; charset=utf-8  
\< Content-Length: 119  
\< Date: Fri, 21 Jun 2019 10:57:48 GMT  
\< Connection: keep-alive  
\<

- Connection #0 to host 127.0.0.1 left intact

- What version of Ghost are you using?  
2.2.5

---

<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:** [June 21, 2019, 11:13am UTC](https://forum.ghost.org/t/allow-access-api-form-localhost/7878/2 "2019-06-21T11:13:57Z")

</div>

@huangyanxiong01 do you have your `url` configured as “https”? If so, your request to localhost when using “[http://localhost:2368](http://localhost:2368)” will be automatically redirected to the configured https url.

Quick-fix is to change your configured url to `http://localhost:2368` if this is a local development install. If you want to keep the configured url you will need to send requests to [https://localhost:2368](https://localhost:2368) or add the `X-Forwarded-Proto` header as in `curl -H 'X-Forwarded-Proto: https' http://localhost:2368/...`

---

<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:** [July 5, 2019, 11:22am UTC](https://forum.ghost.org/t/allow-access-api-form-localhost/7878/4 "2019-07-05T11:22:23Z")

</div>

Closed on July 5, 2019, 11:22am UTC

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