First Party Configuration

First Party

First Party Mode enables the module to send/receive data to/from the sensor, acting as a reverse-proxy for client requests and sensor activities.

First Party Mode requires swapping the 3rd Party JS Snippet with the First Party JS Snippet.

  • By default the enforcer is configured to respond to First Party requests. One can confirm this by inspecting the PerimeterX Lua Module configuration file: /usr/local/lib/lua/px/pxconfig.lua
_M.first_party_enabled = true
  • If the PerimeterX Lua module is enabled on location /, the routes are already open and no action is necessary.
    One can test that the endpoint is responding by browsing to domain.com/<PX_APP_ID without PX prefix>/init.js in which one will receive the First Party JS Sensor.
server {
  listen 80;

  location / {
      #----- PerimeterX protect location -----#
      access_by_lua_block {
        local pxconfig = require("px.pxconfig")
        require("px.pxnginx").application(pxconfig)
      }
      #----- PerimeterX Module End  -----#

      root   /nginx/www;
      index  index.html;
  }
}
  • If the PerimeterX Lua module is NOT enabled on location / then he following routes must be configured within NGINX for First Party Mode to work:
server {
  listen 80;

  location /<PX_APP_ID without PX prefix>/xhr/* {
        #----- PerimeterX protect location -----#
        access_by_lua_block {
          local pxconfig = require("px.pxconfig")
          require("px.pxnginx").application(pxconfig)
        }
        #----- PerimeterX Module End  -----#
  }

  location /<PX_APP_ID without PX prefix>/init.js {
        #----- PerimeterX protect location -----#
        access_by_lua_block {
          local pxconfig = require("px.pxconfig")
          require("px.pxnginx").application(pxconfig)
        }
        #----- PerimeterX Module End  -----#
    }
}

📘

Note

If your NGINX version supports HTTP v2, refer to the HTTP v2 section of the Appendix.

📘

Note

The PerimeterX NGINX Lua Plugin configuration requirements must be completed before proceeding to the next stage of installation.


Did this page help you?