1# Configure generic CHART proxy, reading static directly and proxying dynamic requests to backend
 2
 3ServerName 127.0.0.1
 4
 5<VirtualHost *:${CHART_FRONTEND_PORT}>
 6    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %{ms}T" chart_log_format
 7    CustomLog "|/bin/rotatelogs -L ${CHART_LOG_DIR}/apache.log -c ${CHART_LOG_DIR}/apache-%Y-%m-%d.log 86400" chart_log_format
 8    # Compress output from Django server as well as static text files
 9    AddOutputFilterByType DEFLATE text/css text/html application/javascript
10    # Pages are served by the CHART application server by default.
11    # But we redirect certain URLs to the static file location
12    ProxyPass /${CHART_TRUNC_PREFIX}/static !
13    #ProxyPass /mtg/favicon.ico !
14    ProxyPass /${CHART_TRUNC_PREFIX} http://127.0.0.1:${CHART_PORT}/${CHART_TRUNC_PREFIX} connectiontimeout=5 timeout=1200 max=20 ttl=120 retry=0
15    ProxyPassReverse /${CHART_TRUNC_PREFIX} http://127.0.0.1:${CHART_PORT}/${CHART_TRUNC_PREFIX}
16    DocumentRoot /
17    <Directory />
18        Require all denied
19    </Directory>
20    # --Auth placeholder-- No not edit this comment as the Dockerfile expands it
21    Alias /${CHART_TRUNC_PREFIX}/static /mnt/static
22    <Directory /mnt/static>
23        options indexes followsymLinks MultiViews
24        # Tell the browser to cache for 1 day
25        ExpiresActive On
26        ExpiresDefault "access plus 12 hours"
27        # Switch off etags
28        Header unset Etag
29        FileETag none
30        Require all granted
31    </Directory>
32    <Directory /mnt/static/3rdparty>
33        # Cache 3rdparty files for 7 days on the browser
34        ExpiresDefault "access plus 7 days"
35    </Directory>
36    <Directory /mnt/static/favicons>
37        # Cache favicons for 7 days because they don't change often
38        ExpiresDefault "access plus 7 days"
39    </Directory>
40    <Directory /mnt/static/homepage>
41        # Cache the homepage files for 7 days because they don't change often and
42        # are frequenclty accessed
43        ExpiresDefault "access plus 7 days"
44    </Directory>
45    # Enable /server-status page
46    <IfModule status_module>
47        <Location ${CHART_TRUNC_PREFIX}/server-status>
48            Require all granted
49            SetHandler server-status
50        </Location>
51    </IfModule>
52</VirtualHost>