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 the 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.
Typically, you would proxy path
/highlighter/ on the end-user facing HTTP server to
(or other server where you installed the JObjects Highlighter).
For creating an ad-hoc reverse proxy in the development environment, you can use devd - a local web server for developers.
Download the latest release for your platform, extract the
devd executable and you're good to go.
Assuming that your website is running on the port 8080, open a terminal (command line) window,
cd to the directory where you extracted
devd, and run:
You should see something like:
At this point you can open http://localhost:8081 and it should show your website.
As you will be accessing JObjects Highlighter on a custom path, set the
serviceUrl in Highlighter's
and restart the Highlighter service.
Now you should be able to run Highlighter demo and other examples at http://localhost:8081/highlighter/examples/
Use Nginx proxy_pass directive:
In the context of the complete configuration file
Add ProxyPass directive
VirtualHost section in your Apache HTTP Server config file.
In the k8s environment it's more convenient, from the configuration point of view,
to start JObjects Highlighter on
/highlighter or other desired non-root path right away.
This way ingress controller can pass along the path to the target controller without ugly
JObjects Highlighter internally runs on the Jetty web server. By setting the
in a custom
jetty-env.xml file, and mounting that over the existing one, we can control how jetty responds.