How to implement nodejs to obtain api data from other servers and upload servers to release cross-domain restrictions in the local environment

The description of the

title is not very clear.

the thing is, a project on my side uses an open interface, but this interface has cross-domain restrictions. The project I am working on now is a project without backend. The local environment of vue+axios, uses nodejs for interface forwarding to achieve cross-domain. I would like to ask, how can I lift the cross-domain restrictions on my project in the online environment, or how to configure a proxy forwarding service online

?

use nginx reverse proxy to open the interface, similar to the following:

server {
    listen      80;
    server_name domain.com;

    location /api {
        proxy_pass      http://open_service_url;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

you said "proxy forwarding server" and forwarded it yourself with nodejs. Don't you know what to do? No back-end project at least a web server, right? You can just use nginx as the web server and then proxy that interface, or just use the forwarding script you wrote. Or what do you mean?


node is also used online.
browser-> node-> api


if the development environment uses vue-cli, you must use webpack-dev-server, to write the proxy option directly in the configuration file. Please refer to the link: https://vuejs-templates.githu.


there are many ways. Node.js casually finds a code that serves as a service on the Internet, then starts on the command line, webpack is filled in directly in proxy, and the editor can also create a server. Just pick one and search it

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2c605-2bb21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2c605-2bb21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?