• Resolved Jonas Xander

    (@john-alexander)


    I have https on my website (SSL certificiate).

    In the OneSignal WordPress plugin optionsd, I insert the Rest API key and the App ID, but when I click Save it gives me an 500 internal error.

Viewing 1 replies (of 1 total)
  • Hey there,

    Your server is unable to handle cookies larger than 64 characters in length. Our 3rd party chat support widget Intercom.io is setting this cookie and causing you to be unable to access your site.

    If you’re interested in the technical details of this issue, here’s how to reproduce it:

    Clear all your cookies and load your site successfully.
    Open the Developers Tools console (right click, Inspect, click the ‘Console’ tab), and run the following code:
    function createCookie(name, value, days) {
    if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = “; expires=” + date.toGMTString();
    } else var expires = “”;
    document.cookie = name + “=” + value + expires + “; path=/”;
    }
    var sixtyFourCharacters = “0123456789012345678901234567890123456789012345678901234567890123”;
    var sixtyFiveCharacters = “01234567890123456789012345678901234567890123456789012345678901234”;
    // Set 65-character cookie
    createCookie(sixtyFiveCharacters, “1”, 32);
    Refresh the page, and your site should crash with a 500 error.

    ———————————

    To fix the issue, instead of clearing your cookies, run this code to make your site load properly:

    function createCookie(name, value, days) {
    if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = “; expires=” + date.toGMTString();
    } else var expires = “”;
    document.cookie = name + “=” + value + expires + “; path=/”;
    }
    var sixtyFourCharacters = “0123456789012345678901234567890123456789012345678901234567890123”;
    var sixtyFiveCharacters = “01234567890123456789012345678901234567890123456789012345678901234”;
    // Unset 65-character cookie
    createCookie(sixtyFiveCharacters, “1”, -1);
    // Set 64-character cookie
    createCookie(sixtyFourCharacters, “1”, 32);

    —– How to Remove The Chat Widget From Plugin —-

    Login to your WordPress admin backend, and install the plugin. Please make sure not to visit the OneSignal Push page on your sidebar after installing the plugin before making the below changes, as this will crash your site with the cookie issue. You don’t have to save settings for the crash to occur, just visiting the page is bad enough I think.
    Go to Plugins > Editor (or equivalently, just visit site.com/wp-admin/plugin-editor.php)
    Top right dropdown Select Plugin To Edit, select “OneSignal Push Notifications”.
    On the right sidebar, you’ll see a bunch of plugin files. Search the page for the one ending in onesignal-admin.php.
    Search for the text “intercom” on the page. You should see two matches, and one line in the code that looks like:
    wp_enqueue_script( ‘intercom’, plugin_dir_url( __FILE__ ) . ‘views/javascript/intercom.js’, false, OneSignal_Admin::$RESOURCES_VERSION);
    Remove this line, save your changes, and you’ll be good to go.

    ————————–

    Unfortunately you’ll have to repeat this change on every new WordPress version. I recommend upgrading the server software if possible.

Viewing 1 replies (of 1 total)
  • The topic ‘500 Internal Error when saving options’ is closed to new replies.