# This is a 'vhost' definition file example for use with Starman/LedgerSMB
# reverse proxying.
#
# Please replace the following parameters:
#
#   * WORKING_DIR
#   * YOUR_SERVER_NAME
#   * SSL_KEY_FILE
#   * SSL_CERT_FILE
#   * SSL_CHAIN_FILE
#
#

# this block also requires mod_ssl and mod_rewrite to be enabled

# Comment out the 'Listen' and/or 'NameVirtualHost' when Apache complains
Listen 443
# NameVirtualHost is ignored by Apache 2.4
NameVirtualHost *:443
<VirtualHost *:443>
  ServerName YOUR_SERVER_NAME

  DocumentRoot WORKING_DIR/UI

  # If you own a publicly exposed server, consider submitting it
  # to the SSL security tests available at
  #    https://www.ssllabs.com/ssltest/
  SSLEngine On
  SSLCertificateFile SSL_CERT_FILE
  SSLCertificateKeyFile SSL_KEY_FILE
  SSLCertificateChainFile SSL_CHAIN_FILE

  <Location "/">
    SSLRequireSSL
  </Location>

  RewriteEngine On

  # Rewrite '/' URL to /login.pl script
  RewriteRule "^/$" "/login.pl" [R=301,L]
  # "hidden" files (those starting with a dot), don't exist
  RewriteRule "^/\." - [R=404,L]
  # configuration files (those ending in '.conf'), don't exist
  RewriteRule "\.conf$" - [R=404,L]

  # Rewrite non-static content to the application backend
  RewriteCond "%{REQUEST_FILENAME}" !-f
  RewriteCond "%{REQUEST_FILENAME}" !-d
  RewriteRule "^/(.*)" "http://localhost:5762/$1" [P]
  ProxyPassReverse "/" "http://localhost:5762/"

</VirtualHost>


