Registry / devops / grunt-connect-proxy

grunt-connect-proxy

JSON →
library0.2.0jsnpmunverified

Grunt plugin providing an HTTP proxy middleware for grunt-contrib-connect. Current stable version is 0.2.0 (last release circa 2015, maintenance mode). It allows developers to proxy requests from a local Connect server to remote hosts during development, supporting context path mapping, HTTPS, custom headers, and header hiding. Unlike general-purpose proxies, it integrates directly into Grunt's connect task middleware chain. Requires Grunt ~0.4.1 and is Node >= 0.10.0 compatible. No significant updates since 2015; consider alternatives like http-proxy-middleware for modern projects.

npm install grunt-connect-proxy
INSTALL
IMPORT
SIG · GRUNT-CONNECT-PROX
G
grunt-connect-proxy
devopsjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grunt-connect-proxy
grunt.loadNpmTasks('grunt-connect-proxy');
require('grunt-connect-proxy');
Grunt plugins are loaded via loadNpmTasks in Gruntfile, not direct require.
proxyRequest
var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest;
var proxy = require('grunt-connect-proxy').proxyRequest;
The proxyRequest function is exported from lib/utils, not the main module.
configureProxies
grunt.registerTask('server', ['configureProxies:server', 'connect:server']);
configureProxies is a task registered by the plugin, not a function you import.

Shows complete Gruntfile setup: loading plugin, configuring connect with proxy middleware, adding proxy context, and registering server task.

// Gruntfile.js module.exports = function(grunt) { grunt.loadNpmTasks('grunt-connect-proxy'); grunt.initConfig({ connect: { server: { options: { port: 9000, hostname: 'localhost', middleware: function(connect, options) { var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest; return [proxy, connect.static(options.base)]; } }, proxies: [ { context: '/api', host: 'api.example.com', port: 80 } ] } } }); grunt.registerTask('server', ['configureProxies:server', 'connect:server']); };
Debug
Known issues
gotchaThe configureProxies task must specify the connect target (e.g., configureProxies:server) or proxies will not be applied.
fix
Always pass the target name to configureProxies, e.g., 'configureProxies:server'.
affects: >=0.1.0
gotchaThe middleware function must include the proxy before static files, otherwise requests to proxied paths will be served statically first.
fix
Ensure proxy middleware is first in the middlewares array.
affects: >=0.1.0
gotchaCalling require('grunt-connect-proxy') returns an object, not the proxy function. The proxyRequest function is in lib/utils.
fix
Use require('grunt-connect-proxy/lib/utils').proxyRequest.
affects: >=0.1.0
deprecatedPackage is unmaintained since 2015; no updates for Node versions beyond 0.12 or Grunt 1.x compatibility.
fix
Migrate to modern alternatives like http-proxy-middleware with grunt-contrib-connect or standalone.
affects: >=0.2.0
Errors
Common errors & fixes
Warning: Task "configureProxies" not found.
Missing grunt.loadNpmTasks('grunt-connect-proxy') in Gruntfile.
fix
Add grunt.loadNpmTasks('grunt-connect-proxy'); at the top of your Gruntfile.
TypeError: Cannot read property 'proxyRequest' of undefined
Incorrect require path; trying to import from main module instead of lib/utils.
fix
Use require('grunt-connect-proxy/lib/utils').proxyRequest
Proxy not working, requests bypass middleware
Proxy middleware added after static file middleware in the array.
fix
Ensure proxy is the first middleware in the array: [proxy, ...]
configureProxies:server ran but no proxies active
Target name mismatch or proxies object not inside the correct connect target.
fix
Verify proxies array is inside options of the connect target (e.g., connect.server.options.proxies).
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency; required to load and run the plugin as a Grunt task
Agent activity
6 hits · last 30 days
node
6
Resources