Tag: grunt connect proxy

加载“connect_proxy.js”任务…错误>>types错误:无法读取未定义的属性“原型”

我正在尝试使用grunt运行一个http服务器。 但是,当我在相应的目录中inputgrunt serve时,出现以下错误: Loading "connect_proxy.js" tasks…ERROR >> TypeError: Cannot read property 'prototype' of undefined Loading "connect_proxy.js" tasks…ERROR >> TypeError: Cannot read property 'prototype' of undefined

Grunt-connect-proxy,转发文件不起作用

我正在使用这个库来从grunt(端口9000)转发api-request到节点(端口3012)的api。 https://github.com/drewzboto/grunt-connect-proxy 它在来自服务器的响应是json时起作用。 但是当它是一个图像时它不起作用。 我试图做一个与Apache的代理,它在那里工作。 所以这一定是错误的,我的代理人在咕噜。 这是来自Apache的铬响应: 这是来自grunt服务器的chrome repsonse 响应标签是空的 这些是我正在使用的相关软件包: "grunt": "^0.4.1", "grunt-connect-proxy": "^0.2.0", 这是我的gruntfile.js中的代理 proxies: [ { context: '/api_paros', host: 'localhost', port: 3012, https: false } ], livereload: { options: { open: true, base: [ '.tmp', '<%= yeoman.app %>' ], middleware: function (connect, options) { if (!Array.isArray(options.base)) { options.base = [options.base]; } // […]

如何解决Gruntfile.js中错误configuration的grunt-connect-proxy设置的404错误?

背景: 我正在尝试将我的grunt服务器实例连接到在localhost上运行在同一台机器上的API服务:8080 / api /。 目前使用grunt-connect-proxy来实现这一点。 问题/问题: http://localhost:9000/api/user-profile/ Failed to load resource: the server responded with a status of 404 (Not Found) 我的configuration(下面)是否有一个错误,防止/api请求redirect到localhost:8080的代理服务器? 我的设置(Gruntfile.js): var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest; … // Grunt configuration grunt.initConfig({ // Project settings someApp: appConfig, // The grunt server settings connect: { options: { port: 9000, hostname: 'localhost', livereload: 35729 }, server: […]

带有旁路代理的Webpack-dev-server

如何使用webpack-dev-server实现“代理”(类似于grunt-connect-proxy )选项? 我正在使用Grunt使用webpack和webpack-dev-server 。 Gruntfile.js中的一个任务(下面的代码)能够在端口8080上启动服务器。我想为所有后端数据请求(上下文URL / ajax / *)添加代理设置。 "webpack-dev-server": { options: { webpack: webpackConfig, publicPath: "/src/assets" }, start: { keepAlive: true, watch: true } }