Configuring %CSP.REST for SSL connections
I have an Ensemble installation and just build my first RestService (using %CSP.Rest that forwards them to my Business Service). This works nice and fine when I use postman to make REST calls over http (port 57772). However when I attempt to make a request using https over port 443 I receive the following error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>Not Found</h1>
<p>The requested URL /csp/healthshare/fcoffice/rest/ping was not found on this server.</p>
<hr>
<address>Apache/2.4.18 (Ubuntu) Server at <MyUrl.Com> Port 443</address>
</body>
</html>Now I have an Apache Web Server running that handles SSL calls for my soap calls that go to /csp/healthshare/fcoffice/services/... which is working nice and fine. So I am guessing that either the Apache Web Server, the CSP gateway or my Ensemble Web Application (which dispatches the url to the %CSP.REST class) that is misconfigured. However, insofar I have been unsuccessful in figuring out anything wrong with any of these configurations. Where should I look?
I found this in the apache2.conf of my apache directory:
<Directory "/home/ubuntu/intersystems/fcoffice/csp">
CSPFileTypes csp cls zen cxw
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Require all granted
<FilesMatch "\.(log|ini|pid|exe)$">
Require all denied
</FilesMatch>
</Directory>I guess I somehow need to apply urls. Any suggestion how?
Thanks to the comment the following code was the answer:
<Directory "/home/ubuntu/intersystems/fcoffice/csp/healthshare/fcoffice/rest">
CSP On
SetHandler csp-handler-sa
</Directory>
<Directory "/home/ubuntu/intersystems/fcoffice/csp">
CSPFileTypes csp cls
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Require all granted
<FilesMatch "\.(log|ini|pid|exe)$">
Require all denied
</FilesMatch>
</Directory>
Comments
first thing to check is if the mapping configured in your apache is actually forwarding your URL
/csp/healthshare/fcoffice/rest/ping
to the csp gateway. In this case a wild guess would be: your apache only maps *.csp*.cls.. but not an url like just ping.
I found this in the apache2.conf
<Directory "/home/ubuntu/intersystems/fcoffice/csp">
CSPFileTypes csp cls zen cxw
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Require all granted
<FilesMatch "\.(log|ini|pid|exe)$">
Require all denied
</FilesMatch>
</Directory>
I presume I somehow need to add url's here. How? I can't find any suggestions/examples in the documentation.
Not sure where you looked in the documentation, but if you take a look here: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCGI_ux#GCGI_C194753
The CSP by location example hints you at CSP On. Alternatively you could also configure a wildcard mapping (a couple of paragraphs down)...
Yes I just found that while you posted :P
Ok I updated the apache.conf and it seems to work now. This is what I ended up with:
<Directory "/home/ubuntu/intersystems/fcoffice/csp/healthshare/fcoffice/rest">
CSP On
SetHandler csp-handler-sa
</Directory>
<Directory "/home/ubuntu/intersystems/fcoffice/csp">
CSPFileTypes csp cls
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Require all granted
<FilesMatch "\.(log|ini|pid|exe)$">
Require all denied
</FilesMatch>
</Directory>
Great! And thanks for sharing your solution!
He's all set.
The mapping for apache had to be extended to include urls without extensions (see comments).