How-to
Expose a historian web client through a reverse proxy
Short answer
Forward a port, mapping the client-facing port 8069 to the web client site on port 32569, whenever a host-and-port URL is acceptable; use a rewriting reverse proxy only when the URL must carry a path such as /hcweb, because the web client returns local URLs and redirects that plain forwarding does not rewrite.
On this page
- Port forward or reverse proxy: which one fits?
- Why does the browser jump to the historian's own address?
- How do you set up the port forward?
- What must a path-based reverse proxy rewrite?
- How do you verify access from the demo client?
- Does HTTPS change the arrangement?
- Which one do you deploy for the demo?
- Questions asked
Forward a port when the URL the demo clients type can carry a port number, and deploy a rewriting reverse proxy only when it must carry a path. In the worked example, the firewall publishes 10.0.0.50:8069 and forwards it to the web client site on port 32569, and no rewriting is needed anywhere. The path option, with a URL such as http://myhist/hcweb standing in for that same site, is the only case that justifies a proxy such as NGINX, because the web client returns local URLs and redirects that plain forwarding does not correct. Both configurations follow, with the rewriting a path proxy must do and the checks that separate a routing fault from a data fault.
Port forward or reverse proxy: which one fits? #
Forward the port: one NAT mapping from an external port you pick, 8069 in the example, to the web client site's port on the historian host, 32569 as the default cited for it, covers every demo that can accept a URL like 10.0.0.50:8069.
The choice turns on one thing only: the URL users are allowed to type. A host and a port, or a DNS name and a port, is a pure addressing change at the firewall. A path such as /hcweb means the proxy must also translate between two different URL shapes in both directions, which is where the failures come from.
| Access method | Client-facing URL | What it changes | Decision for the demo |
|---|---|---|---|
| Port forwarding | http://10.0.0.50:8069, or a name in place of the IP | One NAT rule at the firewall; nothing on the historian host | Use it whenever a port number in the URL is acceptable |
| Path-based reverse proxy | http://myhist/hcweb | Routes each request and rewrites redirects and content URLs | Take it on only for a path requirement |
The path requirement is the only reason to accept rewriting. One public name serving several plant applications, the web client under /hcweb and others under their own prefixes, is the usual justification; a demo that can browse the published host and port does not have it.
Why does the browser jump to the historian's own address? #
Because the web client answers with absolute addresses, its own host and its own port, in redirects and embedded links, and HTTP's contract (RFC 9110) has the browser request exactly the URI the server names in a redirect, with no step where a forwarder in between corrects it.
A plain proxy or port forward moves the first request fine: the browser asks the firewall address, the firewall or proxy asks the historian, and a page comes back. The page then carries addresses of its own. Redirects arrive as a Location header naming a URI, and assets are referenced by URLs the application generated. When those name the historian's host or its site port directly, the browser follows them off the client-facing address, and from a network that cannot reach the historian directly, the page breaks.
That is why the failure looks like a proxy problem but is an addressing problem, and why the same URL works when you test from the historian host itself: there, the local addresses the site returns are reachable. The path option adds a second mismatch. The browser requests everything under the prefix while the upstream site serves from its root, so the proxy must translate the path on the way in as well as the addresses on the way out.
How do you set up the port forward? #
Map one external TCP port on the firewall to the web client site and restrict who may use it: with the example numbers, 10.0.0.50:8069 forwards to the historian host's port 32569, and the browser address stays put.
- Read the web client site's configured port on the historian host. The default cited for it is 32569; confirm what your installation actually uses before building on it.
- Create the mapping on the firewall: the client-side address 10.0.0.50, external TCP port 8069, forwarded to the historian host's address on TCP port 32569.
- Permit only the intended sources on that rule, the demo subnet or the specific demo machines, nothing broader.
- If the address bar should show a name, point a DNS record or a host entry on the demo clients at the firewall address, and browse to the name with the external port.
- Open the published URL from a demo client and read the address bar after the first redirect.
The worked example, with the pass and fail lines that decide it:
Browser request http://10.0.0.50:8069/
Firewall rule 10.0.0.50:8069 -> historian host : 32569
Pass address bar still shows 10.0.0.50:8069 after every redirect
Fail address bar changes to the historian host or to port 32569
The pass line is the whole test: a port forward is correct exactly when every URL the site hands back keeps the client-facing host and port. If the site emits absolute redirects to its own address, forwarding cannot fix them, with or without a prefix, and the next section applies. Restricting the rule to named demo sources is the same policy discipline as any remote SCADA access through firewalls and proxies, and it is the one security decision this option asks of you.
What must a path-based reverse proxy rewrite? #
Three things, in both directions: strip the path prefix from requests going in, rewrite the redirect targets coming out, and rewrite absolute URLs inside the returned pages, because a proxy that only forwards the first request does none of the three.
The prefix is the arithmetic. Take one asset path from a page you captured; in this illustrative example it is /hcweb/scripts/app.js, which is 21 characters. The prefix /hcweb is 6 characters, and 21 minus 6 is 15, which is exactly the length of /scripts/app.js, the path the upstream site expects. Every incoming path loses its first 6 characters; every outgoing address must gain them back.
| Direction | Address as generated | What the browser must see |
|---|---|---|
| Request in | http://myhist/hcweb/scripts/app.js | proxied to the site as /scripts/app.js |
| Redirect out | Location: http://myhist:32569/trends | Location: http://myhist/hcweb/trends |
| Content out | page embeds http://myhist:32569/scripts/app.js | page loads /hcweb/scripts/app.js |
On Windows, IIS with the URL Rewrite and Application Request Routing modules does this job; the setting that fixes redirects carrying the original host is reverseRewriteHostInResponseHeaders, reached in the Configuration Editor under system.WebServer -> proxy. On NGINX, the rewrite handling covers the request side and sub_filter rewrites URLs in the response body, on one condition the guides stress: the proxy must send an empty Accept-Encoding upstream, or compressed bodies pass through untouched and no content rewriting happens.
The rule set this example needs, strip the prefix in and rewrite both directions out, is the reverse proxy path rewriting for industrial web servers pattern, and it is worth reading as a pattern rather than a block to paste. When the proxy host is an edge box rather than a dedicated server, an industrial edge reverse proxy URL rewrite configuration covers that deployment shape with the same directives. Build your rules from the URLs your installation actually returns: capture one page and its redirects, write the rules against what you captured, and never assume a generic template matches.
How do you verify access from the demo client? #
From the demo client network, open the entry URL and judge by the address bar: routing is correct when, after every redirect and asset load, the bar still shows the client-facing address you published, and nothing else has appeared in it.
- Record the browser's final URL after the last redirect before you change any setting; that one observation splits the fault.
- Under the path option, open the browser's network view and confirm every asset request carries the prefix; one asset escaping it is one broken page.
- Confirm values render and update; navigation that works over empty trends is a data fault, not a routing fault.
- Retest after any historian upgrade or web client site change, because generated URLs can move with a release.
If the address bar leaves the client-facing host, stop and fix the rewriting layer; no amount of tag or driver checking changes that symptom. If the address holds but pages load slowly once routing is correct, that is server-side performance, the subject of diagnosing a slow historian web client page load on the server. If nothing renders at all and the client never reaches a page, work the connection path first, the way troubleshooting historian trend client connection failures lays it out.
Does HTTPS change the arrangement? #
Terminate it at the client-facing entry point, on a certificate valid for the exact name in the address bar; when HTTPS is a requirement, that entry point is the reverse proxy, because a port forward would need the web client site itself to serve TLS.
With the reverse proxy you terminate TLS on the client-facing name, present a certificate valid for exactly that name, and keep a plain HTTP leg to the historian on the internal segment. With the port forward, TLS would have to be served by the site on its own port, and whether that site serves TLS is a property of your installation, not something to assume. So HTTPS with a proper certificate is the second concrete reason, after the shared public name, to choose the path option. A certificate that does not match the name in the address bar is a fault to fix, not a warning to dismiss.
Which one do you deploy for the demo? #
The port forward, built and tested exactly as the port forward section describes: one NAT rule, one source-restricted permit, one address to hand the demo clients. The rewriting proxy earns its configuration and testing cost only when the URL must carry a path, a shared name serving several applications, or when HTTPS must terminate at the entry point. Anything else is forwarding.
Questions asked
Does the historian vendor have to support reverse proxying for this to work?
Not for the port forward: NAT at the firewall never involves the application, so nothing changes on the historian host. The rewriting proxy also works entirely outside the application, correcting the addresses the web client emits. If your site requires a vendor-blessed proxy mode or a specific component combination, request the documented configuration for your exact installed release from the vendor's support channel.
How many firewall rules does each option need?
Two either way, but they sit in different places. The port forward is one NAT mapping from the external port to the site's port plus one permit rule limited to the demo-client sources. The path proxy needs one permit for clients to reach the proxy and one for the proxy host to reach the historian's site port; nothing is published on the historian itself.
Can the web client share one public address with other plant applications?
Yes, and that is the requirement that justifies the path option: a single name serving several applications, each under its own prefix. Every application behind that proxy needs its own routing and rewrite rules and its own link-by-link test, so plan the effort per application rather than once for the proxy.
Is a port forward acceptable for permanent remote access, or only for the demo?
For a time-boxed demo on a restricted subnet, it is the right size of exposure. For permanent remote access, prefer the reverse proxy: it terminates TLS on one certificate, allows authentication in front of the application, and keeps the historian host unpublished. Either way, the permit rule names its sources.