Please help find a solution.
Unsafe attempt to load URL https://localhost:3000/img/icons.svg from origin http://localhost:3000. Domains, protocols and ports must match.
Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.
Summary
URL: https://localhost:3000/css/style.css
Status: —
Source: —
Initiator:
localhost:1
Seems that the problem is related to SSL.
root>public>css>style.css
app.use(express.static(path.join(__dirname, 'public')));
doctype html
html(lang='en')
head
link(rel='stylesheet' href='/css/style.css' type='text/css')
link(rel='shortcut icon' type='image/png' href='/img/favicon.png')
I googled the issue and it looks like developers experience a similar issue. I tried proposed solutions and it has not fixed the issue.
I switched to chrome and everything works as it should.
Some examples of what has been tried:
res.set(
'Content-Security-Policy',
"default-src 'self';font-src fonts.gstatic.com;style-src 'self' 'unsafe-inline' fonts.googleapis.com"
);
style
include css/style.css
It could be that HSTS for localhost is cached by Safari.
Or it is predefined by your server/express/helmet.
Disable it through helmet. For example like this:
app.use(
helmet({
hsts: false,
})
);
And clear Safari's cache in the Settings: Privacy -> Manage Website Data