Hi all,
I'd like to report an issue when moving from testing environment to production.
I've successfully installed DSpace 7.2 on Ubuntu 20.04.4 LTS in a local testing environment according to the instructions available at the LYRASIS wiki back in April. Recently I decided to switch to a production environment following the instructions at the LYRASIS wiki.
Package Versions:
Tomcat 9.0.31(Ubuntu)
Jdk java-11-openjdk-amd64
Apache2.4.41 (Ubuntu)
Node.js v16.14.2
I’ve setup two SSL enabled virtual hosts on apache2 to redirect requests to the localhost’s ports as suggested. Both virtual hosts (frontend,backend servers) have the same IP address listening on port 443 on a common IP and a common SSL certificate (see conf file below):
<VirtualHost _default_:443>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/mycert.pem
SSLCertificateKeyFile /etc/ssl/private/mycert.key
ProxyPass /server ajp://localhost:8009/server/
ProxyPassReverse /server ajp://localhost:8009/server/
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
</VirtualHost>
The Tomcat AJP Connector wouldn’t work unless I set the secretRequired to “false”
05-Sep-2022 17:03:48.851 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to start component [Connector[AJP/1.3-8009]] at org.apache.catalina.LifecycleException: Protocol handler start failed
…
Caused by: java.lang.IllegalArgumentException: The AJP Connector is configured with secretRequired="true" but the secret attribute is either null or "". This combination is not valid.
Setting the secretRequired to false the AJP Connector works but the HAL Browser does not display as expected see link https://photos.app.goo.gl/2YZkZHiqPLnhVPvy8
Although while accessing localhost:8080/server the HAL browser displays as it should.
Showing only properties section (server name changed for security reasons)
{
"dspaceUI": "https://myserver.eu",
"dspaceName": "DSpace at myserver",
"dspaceServer": "https://myserver.eu/server",
"dspaceVersion": "DSpace 7.2",
"type": "root"
}
As a subsequence the frontend responds with Service Unavailable (500) https://photos.app.goo.gl/9hBe4YYbwCSkh9Jw9 and looking at the browser’s log
There are errors reporting no links available
hal-endpoint.service.ts: No _links section found at https://www.myserver.eu/server/api
Error in dspace.log
2022-09-05 18:11:53,345 ERROR unknown unknown org.springframework.boot.web.servlet.support.ErrorPageFilter @ Forwarding to error page from request [/api] due to exception [The request was rejected because the URL contained a potentially malicious String "//"]
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "//"
at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:369) ~[spring-security-web-5.2.2.RELEASE.jar:5.2.2.RELEASE]
Did someone else face the same situation? Any solution?
Thank you in advance!
Best regards
Thomas
ProxyPass /server ajp://localhost:8009/server/
ProxyPassReverse /server ajp://localhost:8009/server/
should be:
ProxyPass /server ajp://localhost:8009/server
ProxyPassReverse /server ajp://localhost:8009/server
Had to read Apache documentation about the syntax of proxies although it's correctly shown in the LYRASIS installation instructions! REST API works now and so does the frontend.