
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
connect-json-proxy
Advanced tools
grunt-connect middleware to proxy API requests to remote servers without CORS or JSONP. Based on the json-proxy project, for express.
This is a simple package that wraps the json-proxy package, providing support for multiple endpoints based on an HTTP Header or URL parameter.
It fulfils a specific need for internal applications for us, so is NOT designed to be super high performance or on production sites. (for example, it re-initializes the proxy for EVERY request).
Assuming that grunt-connect us running on port 9000, and you can call the following URL to get the connect server to redirect the request to somewhere else.
http://localhost:9000/PortalApp/api/v1/some/service/call?apiProxy=LocalhostNode
redirects to the endpoint defined by LocalhostNode (ie, port 8080)...
http://localhost:8080/PortalApp/api/v1/some/service/call?apiProxy=LocalhostNode
In your Gruntfile.js
var apiProxy = require('grunt-json-proxy').initialize({
// A 'node' is referenced by name in the 'proxy.forward' section below, instead of a URL.
nodes: {
ihportal: {
// Each endpoint is listed here as in key: endpoint format.
'Localhost': 'http://localhost:8080/'
}
},
// If no endpoint name is passed in a http header or url parameter, use this one.
defaultEndpointName: 'Localhost',
// Proxy's, as defined by json-proxy, however the value of each 'forward' entry is a 'node' (as defined above) instead of a url.
proxy: {
forward: {
'/PortalApp/': 'ihportal'
}
}
});
// Define the configuration for all the tasks
grunt.initConfig({
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
middleware: function (connect) {
return [
connect.static(appConfig.app),
// The apiProxy middleware is place HERE
apiProxy
]
}
}
}
}
});
FAQs
grunt-connect middleware to proxy API requests to remote servers without CORS or JSONP. Based on the json-proxy project, for express.
We found that connect-json-proxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.