@@ -207,3 +207,100 @@ User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36
207207
208208--- error_log
209209[PerimeterX - DEBUG] [ PX_APP_ID ] - Visitor score is higher than allowed threshold
210+
211+ === TEST 4: Json response w/first party
212+ verify the json response
213+
214+ --- http_config
215+ lua_package_path "/usr/local/lib/lua/?.lua;/usr/local/openresty/lualib/?.lua;;";
216+ lua_ssl_trusted_certificate "/etc/ssl/certs/ca-certificates.crt";
217+ lua_ssl_verify_depth 3;
218+ lua_socket_pool_size 500;
219+ resolver 8.8.8.8;
220+ init_worker_by_lua_block {
221+ require ("px.utils.pxtimer").application()
222+ }
223+ set_real_ip_from 0.0.0.0/0;
224+ real_ip_header X-Forwarded-For;
225+
226+ --- config
227+ location = /t {
228+ resolver 8.8.8.8;
229+ set_by_lua_block $config {
230+ pxconfig = require "px.pxconfig"
231+ pxconfig.cookie_secret = "perimeterx"
232+ pxconfig.px_debug = true
233+ pxconfig.block_enabled = true
234+ pxconfig.enable_server_calls = false
235+ pxconfig.send_page_requested_activity = false
236+ return true
237+ }
238+
239+ access_by_lua_block {
240+ require("px.pxnginx").application(require "px.pxconfig")
241+ }
242+ }
243+
244+ --- request
245+ GET /t
246+
247+ --- req_headers
248+ X-Forwarded-For: 1.2.3.4
249+ User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
250+ Accept: application/json
251+
252+ --- response_body
253+ {"uuid":"57ecdc10-0e97-11e6-80b6-095df820282c","appId":"PX_APP_ID","firstPartyEnabled":true,"hostUrl":"\/_APP_ID\/xhr","vid":"vid","jsClientSrc":"\/_APP_ID\/init.js","blockScript":"\/_APP_ID\/captcha\/PX_APP_ID\/captcha.js?a=captcha&m=0&u=57ecdc10-0e97-11e6-80b6-095df820282c&v=vid"}
254+ --- error_code: 403
255+
256+ --- error_log
257+ [PerimeterX - DEBUG] [ PX_APP_ID ] - Visitor score is higher than allowed threshold
258+
259+ === TEST 5: Json response wo/ first party
260+ verify the json response
261+
262+ --- http_config
263+ lua_package_path "/usr/local/lib/lua/?.lua;/usr/local/openresty/lualib/?.lua;;";
264+ lua_ssl_trusted_certificate "/etc/ssl/certs/ca-certificates.crt";
265+ lua_ssl_verify_depth 3;
266+ lua_socket_pool_size 500;
267+ resolver 8.8.8.8;
268+ init_worker_by_lua_block {
269+ require ("px.utils.pxtimer").application()
270+ }
271+ set_real_ip_from 0.0.0.0/0;
272+ real_ip_header X-Forwarded-For;
273+
274+ --- config
275+ location = /t {
276+ resolver 8.8.8.8;
277+ set_by_lua_block $config {
278+ pxconfig = require "px.pxconfig"
279+ pxconfig.cookie_secret = "perimeterx"
280+ pxconfig.px_debug = true
281+ pxconfig.block_enabled = true
282+ pxconfig.enable_server_calls = false
283+ pxconfig.send_page_requested_activity = false
284+ pxconfig.first_party_enabled = false
285+ return true
286+ }
287+
288+ access_by_lua_block {
289+ require("px.pxnginx").application(require "px.pxconfig")
290+ }
291+ }
292+
293+ --- request
294+ GET /t
295+
296+ --- req_headers
297+ X-Forwarded-For: 1.2.3.4
298+ User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
299+ Accept: application/json
300+
301+ --- response_body
302+ {"uuid":"57ecdc10-0e97-11e6-80b6-095df820282c","appId":"PX_APP_ID","firstPartyEnabled":false,"hostUrl":"\/\/collector-PX_APP_ID.perimeterx.net","vid":"vid","jsClientSrc":"\/\/client.perimeterx.net\/PX_APP_ID\/main.min.js","blockScript":"\/\/captcha.px-cdn.net\/PX_APP_ID\/captcha.js?a=captcha&m=0&u=57ecdc10-0e97-11e6-80b6-095df820282c&v=vid"}
303+ --- error_code: 403
304+
305+ --- error_log
306+ [PerimeterX - DEBUG] [ PX_APP_ID ] - Visitor score is higher than allowed threshold
0 commit comments