Installation

Error: /webwork2/instructorXMLHandler: Forbidden

Re: Error: /webwork2/instructorXMLHandler: Forbidden

by Nathan Wallach -
Number of replies: 3
I ran into the same issue with
/webwork2/instructorXMLHandler: Forbidden
being reported when trying to use the library browser in a running Docker container available with a real hostname, but no such problem when using the same WW code on Docker on my laptop via "localhost".

The Docker container had the hostname set in Dockerfile via an environment variable like this:
WEBWORK_ROOT_URL=https://myhostname.mydomain

In this case, when using the selector boxes in the library browser the
browser would give an error:
/webwork2/instructorXMLHandler: Forbidden

There were error messages in /var/log/apache2/error.log similar to what
appears below.

The error messages show that there were "routing" problems between the "server" and the target network address. The other (non-Docker) problems of this nature may also be related to similar issues, in which case editing /etc/hosts on the server may help fix them.

Adding a "hostname" line to the "app:" block of docker-compose.yml
hostname: myhostname.mydomain
solved this problem.

Explanation: The WW server inside the docker container is trying to connect to itself on its public web address, but without the "hostname" set in docker-compose.yml it does not know how to connect to that host.

An alternative solution would be to map the FQDN used to the external IP address using "extra_hosts" in docker-compose.yml, but that would needlessly route the traffic out of the docker framework and then back in. (I did not test if it works.)

In the long run, it may make sense to instead use "alias" and set up a network configuration in the docker-compose.yml by hand, as an alias can be shared by multiple "replicas".

See:
See the sections "domainname, hostname" (start of section name) and "ALIASES"
Note: A network-wide alias can be shared by multiple containers

=====================
From: /var/log/apache2/error.log
=====================

There were a lot of errors
Errors:
500 Can't connect to myhostname.mydomain:443 at /opt/webwork/webwork2/lib/WebworkClient.pm line 292.
End Errors
xmlrpcCall to listSetProblems returned no result for
[Mon Nov 19 20:22:36.111578 2018] [perl:error] [pid 1299] [client 213.57.108.112:1952] [/webwork2/instructorXMLHandler] xmlrpcCall to listSe
tProblems returned no result for \n * in WeBWorK::ContentGenerator::instructorXMLHandler::content called at line 233 of /opt/webwork/webwork
2/lib/WeBWorK/ContentGenerator.pm\n * in WeBWorK::ContentGenerator::go called at line 384 of /opt/webwork/webwork2/lib/WeBWorK.pm, referer:
https://myhostname.mydomain/webwork2/test_001/instructor/setmaker/?user=USERNAME&key=SECRET_KEY&effectiveUser=USERNAME


=====================


There were a lot of errors
Errors:
500 Can't connect to myhostname.mydomain:443 at /opt/webwork/webwork2/lib/WebworkClient.pm line 292.
End Errors
xmlrpcCall to searchLib returned no result for
[Wed Nov 21 15:54:26.079333 2018] [perl:error] [pid 1515] [client 132.68.115.60:54758] [/webwork2/instructorXMLHandler] xmlrpcCall to search
Lib returned no result for \n * in WeBWorK::ContentGenerator::instructorXMLHandler::content called at line 233 of /opt/webwork/webwork2/lib/
WeBWorK/ContentGenerator.pm\n * in WeBWorK::ContentGenerator::go called at line 384 of /opt/webwork/webwork2/lib/WeBWorK.pm, referer: http:/
/myhostname.mydomain/webwork2/test_001/instructor/setmaker/?user=USERNAME&effectiveUser=USERNAME&key=SECRET_KEY



In reply to Nathan Wallach

Re: Error: /webwork2/instructorXMLHandler: Forbidden

by Sungwook Lee -

I am currently having the same issue. It causes a number of problems, for example rendering problems or using the library to add problems to  a target assignment with the error message "305 setmaker.js: /webwork2/instructorXMLHandler: Forbidden." Apache2 error log lists the error "500 Can't connect to math.usm.edu:443 (Name or service not known) at /opt/webwork/webwork2/lib/WebworkClient.pm line 302." I added hostname to docker-compose.yml as you suggested (and I restarted apache) but the problem still persists. It also appears to have affected webwork email. What baffles me is that I have not done anything to the server including any kind of routine updates this year. There hasn't been any issue until now. Btw my ww version is 2.15.

I would very much appreciate any insight on this issue.

Thank you.

John

In reply to Sungwook Lee

Re: Error: /webwork2/instructorXMLHandler: Forbidden

by Sungwook Lee -

I resolved the issue. For some reason, DNS entry in the network setting was removed. Once I corrected it, all seems to be working fine. I realized it might have something to do with DNS when I noticed that email messages from webwork are not going out.

John

In reply to Sungwook Lee

Re: Error: /webwork2/instructorXMLHandler: Forbidden

by Sungwook Lee -
Correction: Sorry, webwork email not going out wasn't the primary clue to a possible problem with DNS, rather it was secondary one that supported my suspicion from the primary clue. The primary clue was that I could ping or ssh only IPs but not hostnames associated with the IPs.

John