diff --git a/ui/.env.local.https.example b/ui/.env.local.https.example new file mode 100644 index 00000000000..f0ab16dfcb5 --- /dev/null +++ b/ui/.env.local.https.example @@ -0,0 +1,7 @@ +CS_URL=http://localhost:8080 +PUBLIC_HOST=primate.example.com +HTTPS_CERT=/etc/ssl/certs/primate.example.com.pem +HTTPS_KEY=/etc/ssl/private/primate.example.com.key +HTTPS_CA=/etc/ssl/certs/ca.pem +HTTPS_DHPARAM=/etc/ssl/keys/dh2048.pem +ALLOWED_HOSTS=["primate.example.com","cloud.example.com"] diff --git a/ui/README.md b/ui/README.md index 3432ac09b9c..0cabdb1c8f4 100644 --- a/ui/README.md +++ b/ui/README.md @@ -30,6 +30,8 @@ Override the default `CS_URL` to a running CloudStack management server: cp .env.local.example .env.local Change the `CS_URL` in the `.env.local` file +To configure https, you may use `.env.local.https.example`. + Build and run: npm start diff --git a/ui/vue.config.js b/ui/vue.config.js index c02cac95d59..ef4c105964b 100644 --- a/ui/vue.config.js +++ b/ui/vue.config.js @@ -17,6 +17,7 @@ const path = require('path') const webpack = require('webpack') +const fs = require('fs') function resolve (dir) { return path.join(__dirname, dir) @@ -114,7 +115,15 @@ module.exports = { ws: false, changeOrigin: true } - } + }, + https: process.env.HTTPS_KEY ? { + key: process.env.HTTPS_KEY ? fs.readFileSync(process.env.HTTPS_KEY) : undefined, + cert: process.env.HTTPS_CERT ? fs.readFileSync(process.env.HTTPS_CERT) : undefined, + ca: process.env.HTTPS_CA ? fs.readFileSync(process.env.HTTPS_CA) : undefined, + dhparam: process.env.HTTPS_DHPARAM ? fs.readFileSync(process.env.HTTPS_DHPARAM) : undefined + } : false, + public: process.env.PUBLIC_HOST || undefined, + allowedHosts: process.env.ALLOWED_HOSTS ? JSON.parse(process.env.ALLOWED_HOSTS) : undefined }, lintOnSave: undefined,