/ /

502 Error on osano.js

Updated last month

502 Error on osano.js

Overview

One way the Osano consent banner can fail to appear on a website is when the osano.js request returns a 502 Bad Gateway error instead of loading successfully. When this happens, Osano never initializes, so visitors have no banner and no way to interact with consent preferences.

This article covers how to recognize the issue, the most common root cause, and how to verify a fix.

Symptoms of this issue:

  • The consent banner does not display anywhere on the site.

  • The browser's Developer Tools show the osano.js request failing with a 502 Bad Gateway response.

Because the script itself never loads, Osano has no way to initialize on the page.

Root Cause

The most common cause of this specific error is a malformed osano.js , most often a duplicated Customer ID, typically introduced by a copy-and-paste error during implementation.

Incorrect:

https://cmp.osano.com/customer-id/customer-idconfiguration-id/osano.js

Correct:

https://cmp.osano.com/customer-id/configuration-id/osano.js

At a glance, the malformed script can look valid; the duplication is easy to miss unless the path is checked closely against the expected format.

How to Investigate

  1. Open the browser's Developer Tools and go to the Network tab.

  2. Locate the osano.js request and check its status code.

  3. If it's returning502, inspect the full request URL.

  4. Confirm:

    • The Customer ID appears once, and only once.

    • The Configuration ID is present and valid.

    • The overall script structure matches the documented format: https://cmp.osano.com/customer-id/configuration-id/osano.js

Resolution

The most reliable way to get the correct osano.js is to use the Get Code button within the configuration in Osano, rather than manually editing or retyping the script tag. This avoids the kind of copy-and-paste error that leads to a duplicated ID in the first place.

Once the script is corrected to the proper format, the fix can be confirmed by checking that:

  • osano.js loads successfully.

  • The Network tab shows a 200 response for the request.

  • The consent banner displays as expected.

  • Osano functionality is fully restored.

This type of issue can typically be resolved without escalation or any changes to the account configuration; the fix lives entirely in how the script tag is pasted on the site.

Key Takeaways

When troubleshooting a 502 on osano.js, ask the following :

  • Is the Customer ID present, and does it appear only once?

  • Is the Configuration ID valid?

  • Does the script match the documented format?

  • Does the request return a 200 in the Network tab?

502 error can have multiple causes, but a malformed Customer ID or Configuration ID is a common contributor and should be one of the first things checked.

Was this article helpful?
Subscribe to receive updates on this article