Redundant Failover Http Redirection - Perspective

All - we recently set up and tested our Ignition redundancy (forced a failover). Everything worked very well except for Perspective. We expected inbound requests for Perspective projects to be redirected, yet they were not. For example, we expected requests for: https://masterserver/data/perspective/client/project to have been redirected to: https://backupserver/data/perspective/client/project.

Is this incorrect? Or, is there a needed configuration change to support this? Thanks.

This really isn’t possible the way you’re describing. Think about this: If google.com is down, where would you expect to be getting a redirect to googlebackup.com from? By definition, if the gateway is down and the backup has taken over, there’s no longer any webserver at <primary>/data/perspective/client/project to serve up even a redirect notice to <backup>/data/perspective/client/project. It’s just fundamentally not possible to have a single webserver, in isolation, do what you’re describing. A URL always points to a specific ‘resource’ (hence the name) - so in the ‘naive’ architecture, <primary>/data/perspective/client/project is always the exact location of the primary gateway.

What you’re actually looking for is to have <something>/data/perspective/client/project resolve to some other application, which is acting as a middleman - you would go to <somethingElse>/data/perspective/client/project/, and that other service would conditionally route you to <primary>/data/perspective/client/project or <backup>/data/perspective/client/project. There are infinite possibilities for this - look into load balancers, reverse proxies, etc - nginx is a solid choice for a Linux server. Crucially, this middleman must be at a separate network location - it doesn’t matter to consumers of <yourServer>/data/perspective/client/project, but internally, the middleman itself must have unique addresses for both the primary and backup nodes (or however many nodes you have; true load balancers can scale “horizontally” to multiple nodes). This also isn’t an area Inductive Automation is interested in providing a solution first party - HTTP load balancers are a “solved” problem, and nothing we can come up with would improve on existing open source, free solutions.

There is one caveat/wrinkle/exception to all this - if you are already in a Perspective session when the master -> backup transition happens, things (should) continue to work, “seamlessly”. How? Because the actual Perspective client is a so-called “Single-Page Application” - once you’ve downloaded all the required resources (which happens as soon as you open a Perspective session), everything else is happening, from your web browser’s perspective, on a single page - the frontend is continually talking to some backend via an open websocket, but in the event of a failure on that connection, it will also have downloaded the address of the backup server, and thus the frontend can independently attempt to connect to the backup system. Vision clients work in much the same way. Crucially, though, the difference is in the scope of responsibility - the actual Ignition application (Vision or Perspective) “knows” how to find the backup - but a standalone web browser, pointed at <primary>/data/perspective/client/project, simply cannot know where the backup server is without something there to redirect it.

1 Like

From a general http standpoint, makes complete sense. It’s your last paragraph (seeing how open Perspective sessions behave) that made us wonder if there was some feature that made it doable within Ignition. We’ll take a look at our options. Thanks for the feedback.

Since it came up with a support rep - a small addendum to my last paragraph. Local client fallback, as it works in Vision, is basically not possible within a generic web browser. Browsers, for extremely good security reasons, don’t allow a network location (ie, gatewayIp:8088 to suddenly start requesting local assets - imagine if a malicious website could start asking for local files or interact with local applications with open ports. See Same-origin policy for more information. There are specific customizations you could perform, both on your web browser and both Ignition gateways, to theoretically allow this, but it’s not something that’s currently supported by actual Perspective sessions.