Synthetics alert for redirects from https to http

Is it possible to configure alarm when site uses http instead of https or when we go to https and then redirected to http? This seems like a not good thing that can be detected by synthetics and created alert/inform message.

Hi @Alexander_A,

For scripted tests (browser monitors), it's quite possible to assert the URL of the visited page.

For example:

This test will fail as the page will be redirected from http to https.

step('Goto Github HTTP', async () => {
    await page.goto('http://github.com');

    // Assert URL is HTTP
    expect(page.url().startsWith('http://')).toEqual(true);
});

Whereas the following will pass:

step('Goto Github HTTP', async () => {
    await page.goto('http://github.com');

    // Assert URL is HTTPS
    expect(page.url().startsWith('https://')).toEqual(true);
});

So you can define your assertion however you want, and the based on the status of the monitor, you can setup alert.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.