# Uncomment the following lines to allow access to show-source.cgi.  This allows the "show source" button that is added
# by the "source.pl" macro to work for demonstration "courses".  It requires that a show-source.cgi script be customized
# and placed in the courses html directory.  You will also need to enable the apache2 cgi module with `sudo a2enmod cgi`
# for this to work.  Note that if you have the mpm_event module enabled instead of mpm_worker, then you will need the
# cgid module instead.  Apache2 will automatically select this module if the given command is used.  The "show source"
# button is most useful for webwork "courses" used to train new authors.  It is not desirable to expose the code of
# regular homework questions to students.

#<DirectoryMatch /opt/webwork/courses/[^/]*/html/>
#	Options -MultiViews +SymLinksIfOwnerMatch
#	AllowOverride None
#	Require all granted
#</DirectoryMatch>
#ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2
#ProxyPassMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) !

# Note that if $webwork_url in site.conf is changed, then /webwork2
# should be changed below to match.
<Proxy /webwork2/*>
	Require all granted
</Proxy>

ProxyRequests Off
ProxyPreserveHost On

ProxyPass /webwork2 http://localhost:8080/webwork2 keepalive=On
ProxyPassReverse /webwork2 http://localhost:8080/webwork2
ProxyPass /webwork2/* http://localhost:8080/webwork2/ keepalive=On
ProxyPassReverse /webwork2/* http://localhost:8080/webwork2/

<Location /webwork2/>
	RequestHeader set X-Forwarded-Proto "https"
</Location>

# Note that if $webwork_htdocs_url in site.conf is changed, then /webwork2_files
# should be changed below to match.
<Proxy /webwork2_files/*>
	Require all granted
</Proxy>
ProxyRequests Off
ProxyPass /webwork2_files http://localhost:8080/webwork2_files keepalive=On

# Note that if $pg_htdocs_url in site.conf is changed, then /pg_files
# should be changed below to match.
<Proxy /pg_files/*>
	Require all granted
</Proxy>
ProxyRequests Off
ProxyPass /pg_files http://localhost:8080/pg_files keepalive=On

# Note that if $webwork_courses_url in site.conf is changed, then /pg_files
# should be changed below to match.
<Proxy /webwork2_course_files/*>
	Require all granted
</Proxy>
ProxyRequests Off
ProxyPass /webwork2_course_files http://localhost:8080/webwork2_course_files keepalive=On
