Merge pull request #456 from robbiet480/master

Add CORS and /api/discovery_info docs
This commit is contained in:
Robbie Trencheny 2016-05-09 14:59:44 -07:00
commit fa984d065b
2 changed files with 23 additions and 0 deletions

View File

@ -21,6 +21,9 @@ http:
development: 1
ssl_certificate: /etc/letsencrypt/live/hass.example.com/fullchain.pem
ssl_key: /etc/letsencrypt/live/hass.example.com/privkey.pem
cors_allowed_origins:
- google.com
- home-assistant.io
```
Configuration variables:
@ -30,6 +33,8 @@ Configuration variables:
- **development** (*Optional*): Disable caching and load unvulcanized assets. Useful for Frontend development.
- **ssl_certificate** (*Optional*): Path to your TLS/SSL certificate to serve Home Assistant over a secure connection.
- **ssl_key** (*Optional*): Path to your TLS/SSL key to serve Home Assistant over a secure connection.
- **cors_allowed_origins** (*Optional*): A list of origin domain names to allow [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) requests from. Enabling this will set the `Access-Control-Allow-Origin` header to the Origin header if it is found in the list, and the `Access-Control-Allow-Headers` to `Origin, Accept, X-Requested-With, Content-type, X-HA-access`.
The [Set up encryption using Let's Encrypt](/blog/2015/12/13/setup-encryption-using-lets-encrypt/) blog post gives you details about the encryption of your traffic using free certificates from [Let's Encrypt](https://letsencrypt.org/).

View File

@ -99,6 +99,24 @@ Sample `curl` command:
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" http://localhost:8123/api/config
```
#### {% linkable_title GET /api/discovery_info %}
Returns basic information about the Home Assistant instance as JSON.
```json
{
"base_url": "http://127.0.0.1:8123",
"location_name": "Home",
"requires_api_password": true,
"version": "0.20.0.dev0"
}
```
Sample `curl` command:
```bash
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" http://localhost:8123/api/discovery_info
```
#### {% linkable_title GET /api/bootstrap %}
Returns all data needed to bootstrap Home Assistant.