Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit c555126

Browse files
Merge pull request #254 from PerimeterX/feature/custom-first-party-path
Feature/custom first party path
2 parents 41a6117 + 87b874d commit c555126

File tree

4 files changed

+100
-82
lines changed

4 files changed

+100
-82
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [3.5.0] - 2022-xx-xx
9+
10+
### Added
11+
12+
- Support for `px_custom_first_party_path` configuration
13+
14+
### Changed
15+
16+
- Updated dependencies
17+
818
## [3.4.3] - 2022-06-30
919

1020
### Fixed

lib/pxconfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class PxConfig {
7171
['FILTER_BY_IP', 'px_filter_by_ip'],
7272
['FILTER_BY_USERAGENT', 'px_filter_by_user_agent'],
7373
['FILTER_BY_METHOD', 'px_filter_by_http_method'],
74+
['PX_CUSTOM_FIRST_PARTY_PATH', 'px_custom_first_party_path'],
7475
['PXHD_SECURE', 'px_pxhd_secure_enabled'],
7576
['BACKEND_URL', 'px_backend_url'],
7677
['CUSTOM_COOKIE_HEADER', 'px_custom_cookie_header'],
@@ -315,6 +316,7 @@ function pxDefaultConfig() {
315316
PXHD_SECURE: false,
316317
BACKEND_URL: '',
317318
CUSTOM_COOKIE_HEADER: '',
319+
PX_CUSTOM_FIRST_PARTY_PATH: '',
318320
ENABLE_LOGIN_CREDS_EXTRACTION: false,
319321
LOGIN_CREDS_EXTRACTION: [],
320322
CREDENTIALS_INTELLIGENCE_VERSION: CIVersion.V2,
@@ -374,6 +376,7 @@ const allowedConfigKeys = [
374376
'px_pxhd_secure_enabled',
375377
'px_backend_url',
376378
'px_custom_cookie_header',
379+
'px_custom_first_party_path',
377380
'px_login_credentials_extraction_enabled',
378381
'px_login_credentials_extraction',
379382
'px_credentials_intelligence_version',

lib/pxenforcer.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,10 @@ class PxEnforcer {
532532
let hostUrl = ctx.collectorUrl;
533533

534534
if (this._config.FIRST_PARTY_ENABLED && !ctx.isMobile()) {
535-
const prefix = this._config.PX_APP_ID.substring(2);
536-
jsClientSrc = `/${prefix}${this._config.FIRST_PARTY_VENDOR_PATH}`;
537-
captchaSrc = `/${prefix}${this._config.FIRST_PARTY_CAPTCHA_PATH}/captcha.js?a=${ctx.blockAction}&u=${
538-
ctx.uuid
539-
}&v=${ctx.vid || ''}&m=${ctx.isMobile() ? '1' : '0'}`;
540-
hostUrl = `/${prefix}${this._config.FIRST_PARTY_XHR_PATH}`;
535+
const prefix = this._config.PX_CUSTOM_FIRST_PARTY_PATH || `/${this._config.PX_APP_ID.substring(2)}`;
536+
jsClientSrc = `${prefix}${this._config.FIRST_PARTY_VENDOR_PATH}`;
537+
captchaSrc = `${prefix}${this._config.FIRST_PARTY_CAPTCHA_PATH}${captchaParams}`;
538+
hostUrl = `${prefix}${this._config.FIRST_PARTY_XHR_PATH}`;
541539
}
542540

543541
return {

package-lock.json

Lines changed: 83 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)