Merge pull request #2775 from jplana/re-enable-gulp-backend-proxy
Enable gulp server to proxy backend
This commit is contained in:
commit
6a83da2292
|
@ -6,9 +6,9 @@ var browserSync = require('browser-sync');
|
|||
var httpProxy = require('http-proxy');
|
||||
|
||||
/* This configuration allow you to configure browser sync to proxy your backend */
|
||||
/*
|
||||
var proxyTarget = 'http://localhost/context/'; // The location of your backend
|
||||
var proxyApiPrefix = 'api'; // The element in the URL which differentiate between API request and static file request
|
||||
|
||||
var proxyTarget = 'http://localhost:8000/'; // The location of your backend
|
||||
var proxyApiPrefix = '/api/'; // The element in the URL which differentiate between API request and static file request
|
||||
var proxy = httpProxy.createProxyServer({
|
||||
target: proxyTarget
|
||||
});
|
||||
|
@ -19,7 +19,6 @@ var httpProxy = require('http-proxy');
|
|||
next();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function browserSyncInit(baseDir, files, browser) {
|
||||
browser = browser === undefined ? 'default' : browser;
|
||||
|
@ -27,6 +26,7 @@ function browserSyncInit(baseDir, files, browser) {
|
|||
browserSync.instance = browserSync.init(files, {
|
||||
startPath: '/index.html',
|
||||
server: {
|
||||
middleware: [proxyMiddleware],
|
||||
baseDir: baseDir,
|
||||
routes: {
|
||||
'/bower_components': './bower_components'
|
||||
|
|
Loading…
Reference in New Issue