[Vuejs]-How to proxy to my domain with port from request urls that start with api?

0👍

Use NGINX Reverse Proxy
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

http://localhost:5000 – points to your Vue.js app
http: //localhost:3000 – points to your REST API app

server {

  listen 80;

  server_name example.org;

  location / {
    proxy_pass http://localhost:5000;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
  }

  location ^ ~/api {
    proxy_pass http: //localhost:3000;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
  }
}

Leave a comment