Skip to content

Conversation

kieraneglin
Copy link

Related to #29.

We had a case where we needed to proxy requests for the root-level domain, but didn't want to proxy requests for any subdomains. This is the type of scenario this PR looks to address.

To use this, simply pass a lambda to a constraint option on reverse_proxy. This lambda should return a boolean, but any truthy value will work:

reverse_proxy '/test', 'https://example.com', constraint: ->(req) { req.host === 'root-level-domain.com' }

As you can see, there is access to the rack request object within the constraint.

Usage of constraints is entirely optional and should not pose any issues to backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant