Expressjs: proxy requests to Solr

To proxy requests to solr in ExpressJS, you can use the HTTP proxy:

npm install express-http-proxy --save

When you set this up, you can add the core (here called new_core), and any arguments you want added by default:

var proxy = require('express-http-proxy');
  proxy('http://localhost:8983', {
    forwardPath: function(req, res) {
      return '/solr/new_core/select?wt=json&indent=true&' + 

This will pass anything that goes to “/execute” to your Solr core.

Interested in JavaScript? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *