Solutions

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Learn

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Community

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Company

Stay on top of everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

 
Knowledgebase:
Using MarkLogic with Squid, a Caching Proxy
27 October 2015 08:00 PM

Introduction

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).  

Installing squid

A simple approach is to use the yum package manager to install squid:

sudo yum -y install squid

Configure squid

Create the squid cache directory:

squid -z

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

Start squid

As root or with elevated rights using sudo:

service squid start

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:

Http Response

You should see an http 200 response to show the http request was routed through squid

<response xmlns="xdmp:http">
  <code>200</code>
  <message>OK</message>
  [ ... ]
</response>
(0 vote(s))
Helpful
Not helpful

Comments (0)