Skip to content

Commit

Permalink
adding cors policy
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed May 13, 2023
1 parent cde615d commit 4e5b580
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion workspace/scripts/08-install-pioreactorui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ if [ "$LEADER" == "1" ]; then

# install lighttp and set up mods
apt-get install lighttpd -y
cp /files/system/lighttpd/50-pioreactorui.conf /etc/lighttpd/conf-available/50-pioreactorui.conf
cp /files/system/lighttpd/10-expire.conf /etc/lighttpd/conf-available/10-expire.conf
cp /files/system/lighttpd/50-pioreactorui.conf /etc/lighttpd/conf-available/50-pioreactorui.conf
cp /files/system/lighttpd/51-cors.conf /etc/lighttpd/conf-available/51-cors.conf

lighttpd-enable-mod expire
lighttpd-enable-mod fastcgi
lighttpd-enable-mod rewrite
lighttpd-enable-mod pioreactorui
lighttpd-enable-mod cors

# we add entries to mDNS: pioreactor.local (can be modified in config.ini), and we need the following:
# see avahi_aliases.service for how this works
Expand Down
4 changes: 4 additions & 0 deletions workspace/scripts/files/config.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ temperature=1
dosings=1
event_logs=1

[dosing_automation]
pause_between_subdoses_seconds=5


[dosing_automation.pid_morbidostat]
Kp=5
Ki=0
Expand Down
9 changes: 9 additions & 0 deletions workspace/scripts/files/system/lighttpd/51-cors.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server.modules += ( "mod_setenv" )

$HTTP["url"] =~ "^/static/" {
setenv.add-response-header = (
"Access-Control-Allow-Origin" => "*",
"Access-Control-Allow-Methods" => "GET, OPTIONS",
"Access-Control-Allow-Headers" => "origin, content-type, accept"
)
}

0 comments on commit 4e5b580

Please sign in to comment.