$webwork_url = "/webwork2";
$server_root_url = "https://webwork.myschool.tld/";
I used https://webwork.myschool.tld/webwork2/coursename/ as URL in the LMS.
The problem was that webwork apparently concatenated $server_root_url and $webwork_url to obtain
https://webwork.myschool.tld//webwork2
This did not match (the beginning of) the URL
https://webwork.myschool.tld/webwork2/coursename/
Removing the final slash in $server_root_url solved the problem. I think that it might be helpful to mention in site.conf that no trailing slash should be used in $server_root_url (if one should not use one).