-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
proxy #61
Comments
@gadieichhorn This should be possible by adding a proxy middleware in a custom |
Has anyone been able to put in a bs-config file and get it working? I'm Actually getting in the terminal a "Did not detect a 'bs-config.json' or 'bs-config.js' overide file using lite-server defaults when I have it in my directory. See image of test project error here Not sure if i'm going crazy or not. |
@gadieichhorn here is a working example with lite-server Run:
File: var proxyMiddleware = require('http-proxy-middleware');
var fallbackMiddleware = require('connect-history-api-fallback');
module.exports = {
server: {
middleware: {
1: proxyMiddleware('/api', {
target: 'http://www.example.org',
changeOrigin: true // for vhosted sites, changes host header to match to target's host
}),
2: fallbackMiddleware({
index: '/index.html', verbose: true
})
}
}
}; |
I think the history middleware should be before the proxy middleware. For some reason, when the proxy middleware is first, it never reaches the history one. |
Thanks @cgmartin for the example. Added lite-server to the list of examples: |
thanks it works @cgmartin and @maximedupre! keep with the good work |
its more of a question than an issue...
I am following the NG2 ToH pattern and need to add a proxy to my local server API but would like to keep it simple from the command prompt in the node script section of the package.json
any url calls to /server/api
redirect to
http://192.168.99.100/server/api
thanks
The text was updated successfully, but these errors were encountered: