How do I have HTTPS with Rollup proxy

Viewed 26

I start my Svelte frontend using rollup and I have self signed certificate to use HTTPS locally. Then I need a proxy for my /Api backend. So I import

import dev from 'rollup-plugin-dev';

Then I add

!production && dev({
    dirs: ['public'],
    spa: 'public/index.html',
    port: 8080,
    proxy: [
        { from: '/Api', to: 'https://localhost:7255/Api' },
    ],
}),

And I remove (default in the svelte template)

!production && serve(),

The proxy seems to work, I can reach /Api path without HTTPS. Just there is no HTTPS working anymore: ERR_SSL_PROTOCOL_ERROR in Chrome. Should I specify SSL certificates in the proxy ?

Currently SSL certificates are referenced in package.json

"scripts": {
    "build": "rollup -c",
    "dev": "rollup -c -w",
    "start": "sirv public --no-clear --http2 --cert %AppData%/ASP.NET/https/svelte-app.pem --key %AppData%/ASP.NET/https/svelte-app.key"
  },
0 Answers
Related