Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Support using RegExp values for route table sources #379

tauren opened this Issue · 1 comment

2 participants


I'm creating a multi-tenant web application and need to dynamically add new customers without having to change my proxy table settings. I was hoping to use RegExp values in the proxy table, but am finding that this doesn't work.

Here's an example of various mappings I need to go to the same backend service:

I was attempting to use a routing table that contains regex values for the sources, such as this:

  "router": {
    "": "",
    "^([a-zA-Z0-9]+\\.)?mysite\\.com/api/1/": ""

Unfortunately, this doesn't work. Even though the source string is converted into a RegExp properly, it is also processed by url.parse(). The resulting object doesn't contain the correct values in the properties of the URL object.

So, I'm currently having to hard-code every customer's username into the routing table, like this:

  "router": {
    "": "",
    "": "",
    "": "",
    "": ""

Manually changing this table isn't going to scale long-term. I believe there is a way to dynamically reload the routing table, and I'll probably look at doing that as well. But this table will get very large if I need an entry for every customer. That is not a scalable solution either since this proxy sits in front of every request to my entire infrastructure.

It would be far better if I could just use a RegExp in the table itself. Is there a way to do this and I'm just not aware of it? Would this be of interest to others if I implemented it and submitted a pull request? Any other thoughts?


Checkout 5d515e4, should resolve your issue.

@indexzero indexzero closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.