[ANSWERED]Making REST API work w/ Indigo behind reverse prox

Posted on
Sun Sep 14, 2014 11:24 am
willidiots offline
Posts: 2
Joined: Sep 14, 2014

[ANSWERED]Making REST API work w/ Indigo behind reverse prox

Hi all,

I'm a fairly experienced Indigo user & longtime forum lurker. Thanks guys for making a great product!

I'm trying to create a simple tablet-oriented jquery / static HTML front-end for Indigo, using the RESTful API. I've got it working but am having one issue with the AJAX calls I'm making.

I have Indigo behind a reverse proxy at http://home.example.com/indigo/, and the jquery site at http://home.example.com/lights.html, which shows an icon for each light. Tapping on a light makes a call (via jquery $.get()) to "home.example.com/indigo/devices/<light_name>?toggle=1&_method=put", which works as intended - the light toggles. However, as defined in the documentation, indigo then responds with a redirect to the device resource. The problem is that indigo doesn't know about the /indigo/ RP URL, thus it responds with a redirect to home.example.com/devices/<light_name>. This causes the .get() function to error - which prevents me from making followup function calls (e.g. showing a success message).

I tried updating IndigoWebServer.conf with the app_root_path set to /indigo/, but this doesn't work as I'd hoped - now Indigo wants me to query home.example.com/indigo/indigo/devices/<light_name>.

Is it possible to configure the REST API such that it returns a redirect to the correct URL (/indigo/devices/<device_name>.xml), or doesn't return a redirect at all?

Cheers,

Posted on
Tue Sep 16, 2014 9:07 am
jay (support) offline
Site Admin
User avatar
Posts: 16815
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Making REST API work w/ Indigo behind reverse proxy

willidiots wrote:
Is it possible to configure the REST API such that it returns a redirect to the correct URL (/indigo/devices/<device_name>.xml), or doesn't return a redirect at all?


No built-in way. You may be able to hack the IndigoWebServer templates to do it but I've never actually tried that. Seems like you could also just handle all the redirecting/forwarding in javascript/jquery yourself though that would be more work.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron