From 42744f72c8868f56403d5ae07a8db882e87547cc Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 19 Nov 2019 10:00:41 -0600 Subject: [PATCH] use the vue proxy to avoid cors issues --- src/App.vue | 29 ++++++++++++++--------------- src/components/GuacClient.vue | 4 ++-- vue.config.js | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 vue.config.js diff --git a/src/App.vue b/src/App.vue index 8f35553..91eef32 100644 --- a/src/App.vue +++ b/src/App.vue @@ -42,22 +42,18 @@
- - - - + +
- - - - + + {{scrubbedQuery}}
- - {{scrubbedQuery}} + +
@@ -86,7 +82,7 @@ user: '', pass: '', ignoreCert: true, - nla: false, + security: '', forceHttp: false, } }, @@ -97,7 +93,7 @@ hostname: this.hostname, port: this.port, 'ignore-cert': this.ignoreCert, - nla: this.nla, + security: this.security, username: this.user, password: this.pass } @@ -152,8 +148,8 @@ } .container { - width: 100%; - height: 100%; + width: 100%; + height: 100%; } #app { @@ -166,7 +162,7 @@ } h1 { - text-align: center; + text-align: center; } .field { @@ -187,6 +183,9 @@ margin-left: 1rem; margin-right: 1rem; font-size: 16pt; + border: 1px solid black; + border-radius: 2px; + padding-left: 0.5rem; } .center { diff --git a/src/components/GuacClient.vue b/src/components/GuacClient.vue index 3d6c8d3..a1acf4d 100644 --- a/src/components/GuacClient.vue +++ b/src/components/GuacClient.vue @@ -15,8 +15,8 @@ Guacamole.Mouse = GuacMouse.mouse - const wsUrl = 'ws://127.0.0.1:4567/websocket-tunnel' - const httpUrl = 'http://127.0.0.1:4567/tunnel' + const wsUrl = `ws://${location.host}/websocket-tunnel` + const httpUrl = `http://${location.host}/tunnel` export default { components: { diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..a5badb2 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,18 @@ +const guacClient = 'http://127.0.0.1:4567' + +module.exports = { + devServer: { + proxy: { + '/tunnel': { + target: guacClient, + changeOrigin: true, + ws: false + }, + '/websocket-tunnel': { + target: guacClient, + changeOrigin: true, + ws: true + } + } + } +}