OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Sprinklers_Pi behind secure apache proxy
- This topic has 1 reply, 1 voice, and was last updated 10 years, 3 months ago by Crusader998.
-
AuthorPosts
-
October 14, 2014 at 5:56 pm #33930
Crusader998ParticipantHey all,
I have tried using all the programs ospy and sprinklers_pi. For me sprinklers_pi seems to be the most user friendly (from a UI perspective) and works well for me.
As I always wanted to have this accessible via the internet it needs to be behind a secure encrypted proxy for it to be eligible. Due to the way the code has been written it was difficult to out of the box make it work behind a Apache proxy. So to save people a lot of time here is my Apache config.
This config allows the program to work behind a encrypted SSL proxy with password authentication.
It also fixes the ‘communications failure’ issue when accessing sprinklers_pi via chrome or mobile device.Assumptions:
You are using apache as a reverse proxy.
You already have the mod_proxy enabled.
You already have the mod_substitute enabled.
You created a password file under /etc/apache2/passwd/passwords (this can be changed below).
# Reverse proxy for OpenSprinkler
ProxyPass /opensprinkler http://172.xxx.xxx.xxx:8080
ProxyPassReverse /opensprinkler http://172.xxx.xxx.xxx:8080<Location /opensprinkler>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/passwd/passwords
Require user admin
AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|<a href=\"|<a href=\"/opensprinkler/|i"
Substitute "s|<a href=\"/opensprinkler/javascript\:doRefresh\(\)\;\"|<a href=\"javascript:doRefresh();\"|i"
Substitute "s|<script src=\"http://code.jquery.com|<script src=\"https://code.jquery.com|i"
Substitute "s|rel=\"stylesheet\" href=\"http://code.jquery.com/mobile|rel=\"stylesheet\" href=\"https://code.jquery.com/mobile|i"
Substitute "s|<img src=\"|<img src=\"/opensprinkler/|i"
Substitute "s|rel=\"stylesheet\" href=\"custom.css\"|rel=\"stylesheet\" href=\"/opensprinkler/custom.css\"|i"
Substitute "s|\"json/|\"/opensprinkler/json/|i"
Substitute "s|get\(\"bin/run\"|get(\"/opensprinkler/bin/run\"|i"
</Location>
Hope this helps anyone who’s always wanted a secure way of accessing their sprinkler system.
October 14, 2014 at 6:01 pm #33932
Crusader998ParticipantSorry forgot to add…
The substitute command is basically rewriting some of the code to basically be accessed via https or behind /opensprinkler/
If you don’t want to access the app via https://yourdomain.com/opensprinkler you will need to modify some of that code above.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Sprinklers_Pi behind secure apache proxy