Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly proxy connect/express when proxy is mounted with the optional path #17

Closed
chimurai opened this issue Aug 23, 2015 · 0 comments

Comments

@chimurai
Copy link
Owner

Support different ways of mounting:

app.use(proxy('/api', {target:'http://www.example.org'}));
app.use(proxy('http://www.example.org/api'));    // <-- shorthand 
app.use('/api', proxy('http://www.example.org'));   // <-- with optional path + shorthand

http://expressjs.com/4x/api.html#app.use
When optional path is configured, requests to /api/books/123 should be proxied to http://www.example.org/api/books/123

var proxy = require('http-proxy-middleware');

app.use('/api', proxy('http://www.example.org'));
chimurai added a commit that referenced this issue Apr 18, 2016
* feat(proxy): allow contextless proxy configuration

* fix(connect mounting): use connect's `path` configuration to mount proxy

improve old fix: #17
titan2gman added a commit to titan2gman/typescript-http-proxy that referenced this issue Dec 27, 2022
* feat(proxy): allow contextless proxy configuration

* fix(connect mounting): use connect's `path` configuration to mount proxy

improve old fix: chimurai/http-proxy-middleware#17
weshatleyfl pushed a commit to weshatleyfl/next-common-middlware that referenced this issue Apr 21, 2023
* feat(proxy): allow contextless proxy configuration

* fix(connect mounting): use connect's `path` configuration to mount proxy

improve old fix: chimurai/http-proxy-middleware#17
weshatleyfl added a commit to weshatleyfl/next-common-middlware that referenced this issue Jun 12, 2023
* feat(proxy): allow contextless proxy configuration

* fix(connect mounting): use connect's `path` configuration to mount proxy

improve old fix: chimurai/http-proxy-middleware#17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant