hiddentao / gulp-server-livereload

Gulp plugin to run a local webserver with livereload enabled via socket.io. Also comes with standalone command-line interface.
MIT License
93 stars 28 forks source link

How to connect middleware using proxy ? The way is described in document is not working. #48

Open lawlessnut opened 7 years ago

lawlessnut commented 7 years ago

I'm excepting to forward api request to given target.

   server({
      livereload: {
                enable: true,
                port: 35730,
                defaultFile:"index.html",
                filter: function (filePath, cb) {
                    log(chalk.blue.bgGreen.bold(filePath));
                    cb(!(/node_modules/.test(filePath)));

                }
            },
            open: true,
            port: 9090,
            proxies : [{source: '/nflGame', target:'http://10.21.36.15:8080/nflGame',options: {headers: {'ABC_HEADER': 'abc'}}}]
})
AntonRand commented 7 years ago

+1, I'm having exactly the same issue. Any ideas what's causing this?

AntonRand commented 7 years ago

My bad, wasn't passing it as an Array!

egor-miasnikov commented 7 years ago

@AntonRand could you share an example?

hiddentao commented 7 years ago

@j0gurt Check out the example at the top!

lawlessnut commented 7 years ago

for my requirement i have use browserSync to solve problem. That support multiple proxy forward. https://www.browsersync.io/docs/options