有困难配置角和咕噜-代理连接。
我的静态文件是服务的,但代理的web服务器永远不会被击中。这是我正在工作的gruntfile.js部分。实际的咕噜服务器设置
connect: {
options: {
port: 9000,
hostname: 'localhost',
livereload: 35729
},
proxies: [{
context: '/', // the context of the data service
host: 'localhost/', // wherever the data service is running
changeOrigin: true,
port:3000
}],
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
],
middleware: function (connect, options) {
return [
require('grunt-connect-proxy/lib/utils').proxyRequest,
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},发布于 2014-10-17 09:58:41
也许你错过了那部分?
https://github.com/drewzboto/grunt-connect-proxy#adding-the-configureproxy-task-to-the-server-task
简而言之,在Gruntfile中找到这个部分(我假设它是由约曼角生成器生成的)
grunt.task.run([
'clean:server',
'wiredep',
'concurrent:server',
'autoprefixer',
'configureProxies:server', // ... and add this line
'connect:livereload',
'watch'
]);我还会将代理部分重置为默认值:
proxies: [{
context: '/api',
host: 'localhost', // get rid of the '/'
changeOrigin: false,
port:3000 // hello, fellow Rails developer :)
}],https://stackoverflow.com/questions/25987554
复制相似问题