Reverse Proxying Highlighter

From Wikipedia: In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though they originated from the server itself (or servers themselves).

There are many practical reasons why you would want to setup reverse proxy for PDF Highlighter:

  • It makes the highlighting service available on the same web server and default port where your application is hosted. There is no need to open port 8998 (the default port PDF Highlighter is listening on) on your server or router to allow access to Highlighter from the Internet.
  • Prevents cross-origin (CORS) issues when highlighting PDF viewer tries to access PDF file on your main web site.
  • Simplifies setup if your web application is served via HTTPS.
  • Allows you to authorize users accessing your documents via PDF Highlighter.

Reverse proxy setup differs from one web server to another, but it generally comes down to mapping local URL-space to a remote server. Here is a list of resources you may find useful:

X-Highlighter-Service-URL HTTP Header

With reverse proxying, you may want to send X-Highlighter-Service-URL HTTP header upstream to Highlighter. When present, the value of header overrides serviceUrl specified in the application.conf, allowing the use of a single Highlighter instance with multiple websites. The Highlighter will create result URL in accordance with received header.