OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Sprinklers_Pi behind secure apache proxy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33930

    Crusader998
    Participant

    Hey 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.

    #33932

    Crusader998
    Participant

    Sorry 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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Sprinklers_Pi behind secure apache proxy

We are currently away till Monday July 21. Orders placed during this time will be shipped on Tuesday July 22. Thank you for your understanding!
This is default text for notification bar