Skip to main content

The PreTeXt Guide

Section 38.1 Configuring a WeBWorK Server for PreTeXt

To make use of WeBWorK in your PreTeXt project, you need a WeBWorK server. If someone is providing a WeBWorK server for you, like the AIM server at webwork-ptx.aimath.org, then we assume they have already configured that server for use with PreTeXt, and you may skip this section and move on to Section 38.4.
If you are configuring your own WeBWorK server to use with PreTeXt, we assume a mild familiarity with administrating a WeBWorK server. The version of WeBWorK needs to be 2.14 or later for use with PreTeXt.
The only thing you need to do at this level is set the web server to use certain headers on content that is fetched. These headers tell a web browser that you are authorizing it to display content from this web server as embedded content inside pages from another web server (in particular, where you are hosting you PreTeXt book).
In webwork2/conf/ there should be the apache configuration file webwork-apache2.4-config. This file needs to include the lines:
<IfModule mod_headers.c>
    <Location /webwork2/html2xml>
        Header set Access-Control-Allow-Origin "*"
    </Location>
    <Location /webwork2_files>
        Header set Access-Control-Allow-Origin "*"
    </Location>
</IfModule>
Note there is the distribution file webwork-apache2.4-config.dist, which has these lines (or similar lines) commented out.
If you are certain that your PreTeXt book will only be hosted at one site, (or if you are supporting multiple books, that they will only be hosted at one site) then you should consider replacing the *s above with that site (for example https://mybook.myschool.edu). This will mildly defend against unauthorized use of your WeBWorK server. It will make it so that if there are HTML pages at some other domain and they embed WeBWorK problems that rely on your WeBWorK server, then web browsers will refuse to load the embedded content.
You may also need to enable headers by executing something like sudo a2enmod headers from the command line.
You have attempted of activities on this page.