maddox / harmony-api

🗼 A simple server allowing you to query/control multiple local Harmony Home Hubs over HTTP or MQTT
MIT License
393 stars 115 forks source link

Cross Domain errors when using Jquery #98

Open teknetik opened 6 years ago

teknetik commented 6 years ago

Not su much of an issue but wanted to leave a note for the next tinkerer who might being doing something similar, not being a pro web dev I faced issues when trying to POST commands using Jquery:

no 'access-control-allow-origin' header is present on the requested resource

To avoid this I use apache to reverse proxy the API server:

<VirtualHost *:8000> ProxyPreserveHost On ProxyPass / http://192.168.1.105:8282/ Header add "Access-Control-Allow-Origin" "*" ProxyPassReverse / http://192.168.1.105:8282/ </VirtualHost>

Hope this tip might help another noob one day and issue can be closed.