You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gulp.task('connect',['styles'],function(){varserveStatic=require('serve-static');varserveIndex=require('serve-index');varapp=require('connect')().use(require('connect-livereload')({port: 35729})).use(serveStatic('.tmp')).use(serveStatic('app'))// paths to bower_components should be relative to the current file// e.g. in app/index.html you should use ../bower_components.use('/bower_components',serveStatic('bower_components')).use(serveIndex('app')).use(require('express')());//////////////// PROXY START ////////////////// https://github.com/chimurai/http-proxy-middleware#context-matchingvarproxy=require('http-proxy-middleware');varoptions={target: 'http://localhost:9000',changeOrigin: true};app.use('/api',proxy(options));//////////////// PROXY END ////////////////require('http').createServer(app).listen(8000).on('listening',function(){console.log('Started connect web server on http://localhost:8000');});});
Thank you for your clean example @chimurai, i removed require('express')() (not really sure about it too) but nothing changed, then i also removed serveIndex('app') and everithing seem to work fine now.
maybe there was some conflict with serveStatic('app').
Expected behavior
POST call currectly redirect to proxy port 9000
Actual behavior
redirect errror : 405 (Method Not Allowed)
Setup
Gulp task
Stackoverflow answer: http://stackoverflow.com/questions/37302712/405-not-allowed-error-on-post-call-with-gulp-proxy
The text was updated successfully, but these errors were encountered: