Open ValeryIvanov opened 9 years ago
This can be achieved easily with http-proxy-middleware
:
Example:
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var proxy = require('http-proxy-middleware');
gulp.task('webserver', function() {
gulp.src('app')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: true,
middleware: [
proxy('/api**', {target: 'http://www.example.org', changeOrigin: true})
]
}));
});
gulp.task('default', ['webserver']);
More on the wildcard options can be found on: https://github.com/chimurai/http-proxy-middleware#context-matching
Is it possible to add support for wildcard chars for proxy sources.
Say I have requests i want to capture ends with '.do' then source will be like '/*.do'.
Thanks for your help!