Browse Source

fixed nginx config for vuejs socket

mehmet.kirkoca 2 years ago
parent
commit
f0901f38a7
2 changed files with 16 additions and 43 deletions
  1. 16 5
      nginx.conf
  2. 0 38
      ui/src/components/HelloWorld.vue

+ 16 - 5
nginx.conf

@@ -4,13 +4,24 @@ http {
   server {
     listen 80;
     server_name localhost;
-
+    
     location / {
-      proxy_pass http://ui:5173;
-      proxy_set_header Host $host;
-      proxy_set_header X-Real-IP $remote_addr;
+        proxy_pass http://ui:5173;
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
     }
-    
+
+    location /ws {
+        proxy_pass http://ui:5173;
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
+    }
+
     location /api/ {
       rewrite ^/api/(.*) /$1 break;
       proxy_pass http://gateway:8084;

+ 0 - 38
ui/src/components/HelloWorld.vue

@@ -1,38 +0,0 @@
-<script setup lang="ts">
-import { ref } from 'vue'
-
-defineProps<{ msg: string }>()
-
-const count = ref(0)
-</script>
-
-<template>
-  <h1>{{ msg }}</h1>
-
-  <div class="card">
-    <button type="button" @click="count++">count is {{ count }}</button>
-    <p>
-      Edit
-      <code>components/HelloWorld.vue</code> to test HMR
-    </p>
-  </div>
-
-  <p>
-    Check out
-    <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
-      >create-vue</a
-    >, the official Vue + Vite starter
-  </p>
-  <p>
-    Install
-    <a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
-    in your IDE for a better DX
-  </p>
-  <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
-</template>
-
-<style scoped>
-.read-the-docs {
-  color: #888;
-}
-</style>