Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (app) {
// Proxy the `data.js` trick to the backend server.
// Proxy http://localhost:3001/dashboard/api/diagnose/reports/*/data.js to
// http://http://127.0.0.1:12333/dashboard/api/diagnose/reports/*/data.js
app.use(
'/',
createProxyMiddleware('/dashboard/api/diagnose/reports/*/data.js', {
target: dashboardApiPrefix,
changeOrigin: true,
})
)
// Rewrite the webpage to our static HTML.
// Rewrite http://localhost:3001/dashboard/api/diagnose/reports/*/detail
// to http://localhost:3001/dashboard/diagnoseReport.html
app.use('/dashboard/api/diagnose/reports/:id/detail', function (req, res) {
req.url = paths.publicUrlOrPath + 'diagnoseReport.html'
app.handle(req, res)
})
}
module.exports = (app) => {
app.use(proxy('/api', {
// target: 'http://118.178.132.249:7778/',
target: 'http://localhost:5555/',
changeOrigin: true,
logLevel: "debug"
}));
// mock(app);
};
Object.keys(devProxy).forEach(function(context) {
server.use(
createProxyMiddleware(context, devProxy[context])
);
});
/* eslint-enable */
const { merge } = require('webpack-merge');
const path = require('path');
const proxy = require('http-proxy-middleware');
const Webpack = require('webpack');
const { getDevServerConfig } = require('./helpers');
const baseConfig = require('./webpack.config.base');
const devHost = process.env.DEV_HOST
const target = getDevServerConfig();
const options = {
target: devHost || `http://${target.host}:${target.port}`, // target host
changeOrigin: true, // needed for virtual hosted sites
};
const apiProxy = proxy.createProxyMiddleware(options);
module.exports = merge(baseConfig, {
mode: 'development',
output: {
path: path.resolve(__dirname, '../../build2'),
filename: '[name].bundle.js',
},
optimization: {
noEmitOnErrors: true,
},
devServer: {
port: 4000,
historyApiFallback: true,
before: (app) => {
app.use('/control', apiProxy);
app.use(history({
module.exports = function (app) {
app.use(
"/api/proxy",
createProxyMiddleware({
changeOrigin: true,
headers: {
connection: "keep-alive"
},
target: "/",
onProxyReq: proxyReq => {
if (proxyReq.getHeader("origin")) {
proxyReq.removeHeader("origin");
proxyReq.removeHeader("referer");
}
},
pathRewrite: path => path.replace("/api/proxy", ""),
router: req => `https://${req.headers["x-adt-host"]}/`
})
);
};
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({ target: getProxyUrl(process.env.PROXY) }),
)
app.use(
'/oidc',
createProxyMiddleware({ target: getProxyUrl(process.env.PROXY) }),
)
}
module.exports = function (app) {
app.use(
"/api",
createProxyMiddleware({
target: "http://10.0.0.19",
changeOrigin: true,
})
);
};
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({ target: getProxyUrl(process.env.PROXY) }),
)
}
module.exports = function expressMiddleware(router) {
if (target) {
router.use('/_status', proxy.createProxyMiddleware({
target,
changeOrigin: true
}))
}
}
Object.keys(devProxy).forEach(function (context) {
server.use(createProxyMiddleware(context, devProxy[context]));
});
}