live-server icon indicating copy to clipboard operation
live-server copied to clipboard

How to use proxy is not clear & throws error

Open geoguide opened this issue 6 years ago • 2 comments

Before submitting an issue, please, see https://github.com/tapio/live-server#troubleshooting

Issue description

Trying to add proxy to command line fails. Throws:

Error: connect ECONNREFUSED 127.0.0.1:80
   at Object._errnoException (util.js:1024:11)
   at _exceptionWithHostPort (util.js:1046:20)
   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

Would like to do something like --proxy=:.html also but can't figure out how to do that.

Software details

  • Command line used for launching live-server: live-server --port=8999 --no-browser --proxy=/who-we-are:/who-we-are.html

  • OS: OSX

  • Browser (if browser related): Chrome

  • Node.js version: v8.9.1

  • live-server version: 1.2.0

Edit: also is there a way to support ejs or some other templating tool?

geoguide avatar Feb 15 '18 20:02 geoguide

How to use proxy for node usage?

SelinaYu avatar Nov 08 '18 07:11 SelinaYu

How to use proxy for node usage?

In case anyone is wondering 4 years later, this is the syntax to add to node server params:

proxy: [["/api/", "http://localhost:5000"]]

christophriley avatar Jul 29 '22 13:07 christophriley