Skip to content

Load the AWS WAF challenge.js directly on edge and demo - #4842

Closed
reakaleek wants to merge 1 commit into
mainfrom
fix/waf-challenge-js-url
Closed

reakaleek wants to merge 1 commit into
mainfrom
fix/waf-challenge-js-url

Conversation

@reakaleek

Copy link
Copy Markdown
Member

Why

  • On edge, the telemetry token wait from Telemetry: wait for the AWS WAF token before each export #4817 gives up right away, so exports don't wait for the AWS WAF token.
  • waf_integration_url points to the CAPTCHA script jsapi.js. It is a loader: it adds challenge.js and fires its load event before window.AwsWafIntegration exists, so loadWafSdk fails.
  • The docs only need a token, not CAPTCHA. Loading challenge.js directly fixes the failure, saves one request, and gets the token about 200 ms sooner.

Part of elastic/docs-eng-team#1192

What

  • Point waf_integration_url on edge and demo at https://33d8ddf078ac.edge.sdk.awswaf.com/33d8ddf078ac/challenge.js.
  • Say in docs/development/page-feedback.md which script URL to use and why.

Notes

  • Measured on edge in a clean browser context, with the page's request swapped to challenge.js:

    jsapi.js challenge.js
    WAF script requests 2 1
    AwsWafIntegration defined 592 ms, after load 372 ms, before load
    Token call done 714 ms 513 ms
  • With this URL, getToken() works, and /o/l and /o/t exports return 200 with the cookie.

  • This URL is the one jsapi.js itself loads. I did not compare it with the AWS console's intelligent threat integration URL. Check that one if it differs.

  • Replaces Load the AWS WAF SDK from the page head #4841, which kept jsapi.js and waited for the global instead.

🤖 Generated with Claude Code

@reakaleek

Copy link
Copy Markdown
Member Author

Closing in favour of #4841. The challenge.js URL here is the account-level script that jsapi.js loads internally, and AWS doesn't document it. For web ACLs with common Bot Control, the documented route is the CAPTCHA jsapi.js. #4841 keeps it and waits for AwsWafIntegration.

@reakaleek reakaleek closed this Nov 12, 2026
@reakaleek
reakaleek deleted the fix/waf-challenge-js-url branch November 12, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant