# Allow localhost JavaScript domain?

**URL:** <http://forum.companieshouse.gov.uk/t/allow-localhost-javascript-domain/83>\
**Category:** Uncategorized\
**Created:** [May 17, 2015, 10:43pm UTC](http://forum.companieshouse.gov.uk/t/allow-localhost-javascript-domain/83 "2015-05-17T22:43:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tom\_Roberts](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@Tom\_Roberts](http://forum.companieshouse.gov.uk/u/Tom_Roberts)\
**Post date:** [May 19, 2015, 10:00pm UTC](http://forum.companieshouse.gov.uk/t/allow-localhost-javascript-domain/83/2 "2015-05-19T22:00:20Z")

</div>

Answered my own question (after some trial and error). The problem was fairly trivial, but it had me scratching my head for some time so I’ll post the solution here in case it helps anyone else in a similar situation.

I was unable to add ‘[http://localhost](http://localhost)’ to the authorized JavaScript domains, so the solution was to create an alias for localhost in my hosts file, in this case modifying /etc/hosts, adding the line:

127.0.0.1 [application.com](http://application.com)

Then adding ‘[http://application.com](http://application.com)’ to the authorized JavaScript domains. I think the API expects a URL consisting of three parts, i.e. protocol, second-level and top-level domain. So [http://domain.domain](http://domain.domain)

Might I suggest mentioning in the API docs that ‘[http://localhost](http://localhost)’ is not permitted as an authorized domain?

Hope that helps anyone uncertain how to access the API from localhost domain.

Cheers

---

_[View the full topic](http://forum.companieshouse.gov.uk/t/allow-localhost-javascript-domain/83)._
