Using MarkLogic with Squid, a Caching Proxy
27 October 2015 08:00 PM
Can MarkLogic Server be used behind a caching proxy such as Squid?
We present some general pointers and tips for setting up Squid, and we provide an example of how you can use MarkLogic Server to retrieve data through Squid. This example has been tested with Squid 2 (on RHEL/CentOS 5) and Squid 3 (on RHEL/CentOS 6 and 7).
A simple approach is to use the yum package manager to install squid:
Create the squid cache directory:
Modify the config file
Line 921 of /etc/squid/squid.conf (in Squid 2.6)
http_port 3128 transparent
note the "transparent" after the http_port
As root or with elevated rights using sudo:
Tail the log
tail -f /var/log/squid/access.log
Troubleshooting: ensure it's not an issue with SELinux or the firewall
If there are issues with the response timing out, be sure to check your firewall rules and your SELinux configuration as these could be blocking the request.
Sample XQuery code
The code below demonstrates a call being made through squid out to http://www.marklogic.com:
You should see an http 200 response to show the http request was routed through squid