{"id":18404,"library":"grunt-connect-proxy","title":"grunt-connect-proxy","description":"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.","status":"maintenance","version":"0.2.0","language":"javascript","source_language":"en","source_url":"git://github.com/drewzboto/grunt-connect-proxy","tags":["javascript","gruntplugin","proxy","connect","http","grunt"],"install":[{"cmd":"npm install grunt-connect-proxy","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-connect-proxy","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-connect-proxy","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to load and run the plugin as a Grunt task","package":"grunt","optional":false}],"imports":[{"note":"Grunt plugins are loaded via loadNpmTasks in Gruntfile, not direct require.","wrong":"require('grunt-connect-proxy');","symbol":"grunt-connect-proxy","correct":"grunt.loadNpmTasks('grunt-connect-proxy');"},{"note":"The proxyRequest function is exported from lib/utils, not the main module.","wrong":"var proxy = require('grunt-connect-proxy').proxyRequest;","symbol":"proxyRequest","correct":"var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest;"},{"note":"configureProxies is a task registered by the plugin, not a function you import.","wrong":"","symbol":"configureProxies","correct":"grunt.registerTask('server', ['configureProxies:server', 'connect:server']);"}],"quickstart":{"code":"// Gruntfile.js\nmodule.exports = function(grunt) {\n  grunt.loadNpmTasks('grunt-connect-proxy');\n  grunt.initConfig({\n    connect: {\n      server: {\n        options: {\n          port: 9000,\n          hostname: 'localhost',\n          middleware: function(connect, options) {\n            var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest;\n            return [proxy, connect.static(options.base)];\n          }\n        },\n        proxies: [\n          {\n            context: '/api',\n            host: 'api.example.com',\n            port: 80\n          }\n        ]\n      }\n    }\n  });\n  grunt.registerTask('server', ['configureProxies:server', 'connect:server']);\n};","lang":"javascript","description":"Shows complete Gruntfile setup: loading plugin, configuring connect with proxy middleware, adding proxy context, and registering server task."},"warnings":[{"fix":"Always pass the target name to configureProxies, e.g., 'configureProxies:server'.","message":"The configureProxies task must specify the connect target (e.g., configureProxies:server) or proxies will not be applied.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure proxy middleware is first in the middlewares array.","message":"The middleware function must include the proxy before static files, otherwise requests to proxied paths will be served statically first.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use require('grunt-connect-proxy/lib/utils').proxyRequest.","message":"Calling require('grunt-connect-proxy') returns an object, not the proxy function. The proxyRequest function is in lib/utils.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Migrate to modern alternatives like http-proxy-middleware with grunt-contrib-connect or standalone.","message":"Package is unmaintained since 2015; no updates for Node versions beyond 0.12 or Grunt 1.x compatibility.","severity":"deprecated","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add grunt.loadNpmTasks('grunt-connect-proxy'); at the top of your Gruntfile.","cause":"Missing grunt.loadNpmTasks('grunt-connect-proxy') in Gruntfile.","error":"Warning: Task \"configureProxies\" not found."},{"fix":"Use require('grunt-connect-proxy/lib/utils').proxyRequest","cause":"Incorrect require path; trying to import from main module instead of lib/utils.","error":"TypeError: Cannot read property 'proxyRequest' of undefined"},{"fix":"Ensure proxy is the first middleware in the array: [proxy, ...]","cause":"Proxy middleware added after static file middleware in the array.","error":"Proxy not working, requests bypass middleware"},{"fix":"Verify proxies array is inside options of the connect target (e.g., connect.server.options.proxies).","cause":"Target name mismatch or proxies object not inside the correct connect target.","error":"configureProxies:server ran but no proxies active"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}