Retrieve the Unique X-OAG-Host Value of an Okta Access Gateway Node
Last Updated:
Overview
Each Okta Access Gateway (OAG) node has a unique x-oag-host value returned as a response header to verify front-end load balancer session stickiness. Retrieve this unique value for a session or a specific node by accessing the admin node shell or issuing a command-line request. When a misconfiguration directs a request to an incorrect node, the browser displays one of the following errors:
ERROR: Reading content from file: /opt/oag/configs/spgw/config/spgw.json
400: Unknown Host
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Access Gateway (OAG)
- Load Balancing
Solution
How is the x-oag-host value retrieved for all nodes in a cluster?
Log in to the admin node, access the shell, switch to the oagha user, and run the provided script to get the x-oag-host value of all nodes in the cluster.
- Log in to the admin node and access the shell.
- Switch the user to the
oaghauser: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;
Retrieve the x-oag-host value for a specific node.
Issue a command-line request to the node IP address and search for the x-oag-host response header to get the value for a specific OAG node, repeating this action for all node IP addresses in the cluster.
- Windows 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 the x-oag-host value in the application request.
Compare the node values with the x-oag-host value in the actual request to the OAG application by replacing the OAG node IP address with the public URL in the command-line requests, or by locating the value in the browser 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.
