{"id":10980,"library":"grunt-http-server","title":"Grunt HTTP Static Server","description":"grunt-http-server is a Grunt task designed to serve static files from within a Grunt build process. It allows developers to quickly set up a local HTTP or HTTPS server for development and testing purposes. The package, currently at version 2.1.0 (last published in 2015), offers features such as serving files from a specified root directory, configurable ports and hosts, caching, directory listing, automatic index file serving, custom file extensions, and a proxying capability for requests not resolved locally. It also supports HTTPS with custom certificates and allows opening a browser automatically. Its primary differentiation lies in its integration with the Grunt ecosystem, providing a task-based approach to running a simple web server, unlike modern standalone CLI tools or bundler-specific development servers. The project has not seen updates since 2016, indicating it is no longer actively maintained.","status":"abandoned","version":"2.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/divhide/node-grunt-http-server","tags":["javascript","grunt","gruntplugin","http-server","http","https","server","web","web-server"],"install":[{"cmd":"npm install grunt-http-server","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-http-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-http-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for this Grunt task to function.","package":"grunt","optional":false}],"imports":[{"note":"This package is a Grunt plugin that registers the `http-server` multi-task. It is not directly imported as a JavaScript module but loaded via Grunt's plugin system within your Gruntfile.js.","wrong":"import { 'http-server' } from 'grunt-http-server';\n// OR\nconst http_server = require('grunt-http-server');","symbol":"grunt-http-server","correct":"grunt.loadNpmTasks('grunt-http-server');"},{"note":"The `http-server` task is configured as a multi-task within your Gruntfile's `initConfig` object after being loaded with `loadNpmTasks`.","symbol":"http-server task configuration","correct":"grunt.initConfig({\n    'http-server': {\n        'dev': {\n            root: 'dist',\n            port: 8080\n        }\n    }\n});"}],"quickstart":{"code":"module.exports = function(grunt) {\n\n    grunt.initConfig({\n        'http-server': {\n            'dev': {\n                // the server root directory\n                root: 'dist', // Assume 'dist' is your build output folder\n\n                // the server port\n                port: 8282,\n\n                // the host ip address\n                host: '0.0.0.0',\n\n                cache: 0, // No caching for dev\n                showDir: true,\n                autoIndex: true,\n                ext: 'html',\n                runInBackground: false,\n                logFn: function(req, res, error) {},\n                // proxy: 'http://someurl.com',\n                https: {\n                    cert: 'path/to/cert.pem', // Replace with your actual cert path\n                    key : 'path/to/key.pem'   // Replace with your actual key path\n                },\n                openBrowser : true,\n                customPages: {\n                    '/readme': 'README.md'\n                }\n            }\n        }\n    });\n\n    // Load the plugin that provides the 'http-server' task.\n    grunt.loadNpmTasks('grunt-http-server');\n\n    // Default task.\n    grunt.registerTask('default', ['http-server:dev']);\n};\n","lang":"javascript","description":"This quickstart demonstrates how to configure and run a basic static HTTP server using `grunt-http-server` within a Gruntfile, serving files from a 'dist' directory, enabling HTTPS, and opening a browser automatically."},"warnings":[{"fix":"Consider migrating to actively maintained static server solutions like `http-server` (CLI), `serve`, `browsersync`, `webpack-dev-server`, or `vite` for better compatibility, features, and security.","message":"The `grunt-http-server` package is abandoned and no longer maintained. Its last update was in 2016. Using it may introduce compatibility issues with modern Node.js versions and lacks ongoing security patches. It is not recommended for new projects or production environments.","severity":"gotcha","affected_versions":">=2.1.0"},{"fix":"Thoroughly test on your target Node.js version. If issues arise, migration to a more current static server solution is highly recommended.","message":"This package was developed for older Node.js versions (>=0.8.0). It may exhibit unexpected behavior, throw errors, or fail to run entirely on modern Node.js runtimes (e.g., Node.js 16+ or 18+).","severity":"gotcha","affected_versions":">=2.1.0"},{"fix":"Migrate to actively maintained static server solutions with a strong security track record to mitigate potential vulnerabilities.","message":"As an unmaintained package, `grunt-http-server` has not received security updates since 2016. It may contain unpatched vulnerabilities, particularly concerning path traversal, directory listing exploits, or other common web server security flaws. Avoid using it in production environments or with untrusted content.","severity":"gotcha","affected_versions":">=2.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure `grunt.loadNpmTasks('grunt-http-server');` is present in your Gruntfile.js and that the task name used in `grunt.registerTask` (e.g., 'http-server:dev') matches your configuration.","cause":"The Grunt task was not loaded correctly, or the task name in `registerTask` does not match the configured task.","error":"Warning: Task \"http-server:dev\" not found."},{"fix":"Change the `port` option in your `http-server` configuration to an available port number (e.g., 8000, 9000), or identify and terminate the process currently using that port.","cause":"The specified `port` (e.g., 8080) in the `http-server` configuration is already in use by another application or process on your system.","error":"Error: listen EADDRINUSE: address already in use :::8080"},{"fix":"Verify that the `root` option in your `http-server` configuration specifies the correct absolute or relative path to your static asset directory, relative to your Gruntfile.js.","cause":"The `root` path specified in the `http-server` configuration does not correctly point to the directory containing your static files.","error":"Server started at http://0.0.0.0:8282, but files are not loading or return 404."}],"ecosystem":"npm"}