SDK - Lighttpd web server Access Control Allow Origin

From edgertronic high speed video camera
Jump to navigation Jump to search


Home

Serial console support




Introduction

Edgertronic uses the lighttpd web server. If you want to allow pages outside the camera to be requested by lighttpd, you need to modify lighttpd configuration file.

Do not change the contents of the microSD card that came with the camera. Instead, get a high quality fast micro SD and put a fresh code image on the new microSD card. Then you can edit the file on the new microSD card and still have the original microSD card if something should go wrong with the new microSD card.

Get the sd card image file for the new microSD card from the Software releases page.

Then follow the How to program a micro SD card instructions to properly program the micro SD card. The sd card image file includes the partition table with 3 partitions, and content for all 3 partitions. The camera will reboot on the first power up to get everything in place.

Once the camera is up and running with the new microSD card, determine the IP address of the camera and then telnet into the camera.

Run these commands in your telnet session:

rw
cd /etc/lighttpd
cp lighttpd.conf lighttpd.conf.orig
vi lighttpd.conf

Around line 114 add the following line:

 setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )

Save, exit vi and restart the lighttpd server by running

 killall -9 python lighttpd ; sleep 1 ; /etc/init.d/lighttpd start

Verify lighttpd didn't find an error in the config file by running

 tail -n 60 /var/log/messages

On your host comptuer, use a browser to request a page from lighttpd, such as

 http://10.11.12.13/get_camstatus

or

 http://10.11.12.13/static

replacing 10.11.12.13 with your camera's IP address as necessary.

Then use the tools menu in the browser to view the header and look for the line:

 Access-Control-Allow-Origin:*




Home

Serial console support