Running dev environment on https

Hi all,

Currently I am working on an Aurelia app that is fully developed. In the dev environment, it is only serving http requests. Anyone could help me with adding https so can I can access the app through https?

This is in relation to me trying solve the issue with my application having issues on Chrome browser where when run locally, I get the following error:

Cookies marked with SameSite=None must also be marked with Secure to allow setting them in a cross-site context

assuming you’re using webpack just adjust your webpack config DevServer | webpack

Also, it depends a little bit on the domain you’re working with. By default localhost is showing a warning when run under SSL, since it can only be a self-signed certificate.
image

Since it is the local dev environment, I guess (same as we do), you run au run --watch (for AU1 that is)?
We have changed part of the run.ts to support https.

You might need to import fs:

import * as fs from "fs";

Then, add a check to support the self signed certificates. Of course feel free to change the locations of the certificates. And don’t forget to add the key and crt to your .gitignore.

if (fs.existsSync(__dirname + "/../../server.key") && fs.existsSync(__dirname + "/../../server.crt")) {
    httpsValue = {
        key: fs.readFileSync(__dirname + "/../../server.key"),
        cert: fs.readFileSync(__dirname + "/../../server.crt")
    };
}

Next, in the runWebpack function, change the https value to the following:

https: httpsValue,

HTH

1 Like

Thanks all for your replies. I made the connections from the Aurelia app to the API service through HTTPS and the error is gone.