Skip to content

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

@chimurai

Description

@chimurai

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'));

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions