Each Okta Access Gateway (OAG) host has a unique x-oag-host value that is returned as a response header to each request. This can be used to ensure that the front-end load balancer session stickiness is working properly (that is, the same node handles all requests in the session) and that requests reach the intended nodes.
If the request is being directed to an incorrect node (for example, a node in a different cluster) due to some misconfiguration, the browser may show an error:
ERROR: Reading content from file: /opt/oag/configs/spgw/config/spgw.json or an OAG error page 400: Unknown Host
This article explains how to retrieve the x-oag-host value for a session and a specific OAG node.
- Okta Access Gateway (OAG)
- Load Balancing
Cluster
To get the x-oag-host value of all of the nodes in the cluster, log in to the admin node, and access the shell:
- Switch user to the oagha user:
sudo su - oagha
- Run this script:
for ip in $(awk '/ha_destination_nodes|ha_admin_node/ {print $3}' /opt/oag/configs/events/config/ha_configuration.config | awk '{RS=","}{$1=$1}1'); do ssh -qo StrictHostKeyChecking=no $ip "echo "HOSTNAME: " "$ip";echo "Match x-oag-host: "; grep oag /opt/oag/nginx/conf/nginx.conf"; printf "\n\n"; done;
Individual
To get the x-oag-host value of a specific OAG node, issue a cURL request to the node's IP, and look for the x-oag-host response header. This should be done for all node IPs in the cluster.
- Command Prompt:
$ curl -ski <OAG Node IP> | findstr -i x-oag-host
x-oag-host: bb4a8e623fddfd06d1e1a928762abc2a32d8f8ce40bda5b0d82a13f75041667e
- Bash:
$ curl -ski <OAG Node IP> | grep -i x-oag-host
x-oag-host: bb4a8e623fddfd06d1e1a928762abc2a32d8f8ce40bda5b0d82a13f75041667e
Compare these values with the x-oag-host value in the actual request to the OAG application.
This can be done by replacing the OAG node IP with the public URL of the application in the above cURL requests or the browser's Developer Tools:
- Open the browser's developer tools (for example, Ctrl + Shift + i).
- Select the Network tab (wifi symbol in Firefox).
- Navigate to the OAG application.
- Select the request for the public URL in the Network tab.
- In the right pane, scroll down to find the
X-Oag-Hostvalue in the Response Headers section.
