johnpapa / lite-server

Lightweight node server
MIT License
2.31k stars 267 forks source link

proxy https request #100

Open dashng opened 8 years ago

dashng commented 8 years ago

I need to proxy pass https server to local, it doest work.

Does anyone have any suggestions on this?

Thanks.

pabl-o-ce commented 8 years ago

It seems that lite-server don't work right for proxy [I think is because lite-server was made to handle SPA's if you use Angular routes]. I try with browser-sync and work (I'm using nodemon and browser-sync). But I don't know if that can handle the angular 2 route. I leave you my try of config the lite server and don't make anything.

screen shot 2016-09-13 at 3 21 01 pm

if you have some idea how use proxy with lite-server please help this human beings. 👍

maciej-gurban commented 8 years ago

Have you tried creating a custom middleware to proxy your calls? This article could be helpful.

pabl-o-ce commented 8 years ago

This issue is duplicate the solution is #68: at bs-config.js:

let proxy = require('http-proxy-middleware');
let fallback = require('connect-history-api-fallback');
module.exports = {
    server: {
        middleware: {
            1: proxy('/', {target: 'http://localhost:8000', changeOrigin: false }),
            2: fallback({index: '/index.html', verbose: true})
        }
    },
};

package.json:

 lite-server start -c bs-config.js

And thats the way we like it! 😎

giovannyreyeso commented 7 years ago

@pablocarreraes Thanks! its work for my problem, thanks!