Hi
What is the recommended way to setup a proxy server from localhost to our development webservice?
For example when calling the url: http://localhost:8000/ords/bm/some_procedure, we would like it to proxy the request.
Example setup in webpack, where we need a similar working setup in Oracle Jet:
devServer: {
port: 9000,
compress: true,
writeToDisk: true,
contentBase: path.join(__dirname, 'dist'),
proxy: {
'/bm/utf8': {
target: 'https://testsecure.xxxxx.dk',
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
headers: {
Origin: 'https://testsecure.xxxxx.dk',
Host: 'testsecure.xxxxx.dk'
},
secure: false
}
}
//watchContentBase: true
}
Browsersync example from another project not using Oracle Jet:
let proxy = httpProxyMiddleware(['/bsk/utf8', '/bskk/utf8', '/ords'], {
target: 'https://testsecure.xxxxx.dk',
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
headers: {
Origin: 'https://testsecure.xxxxx.dk',
Host: 'testsecure.xxxxx.dk'
},
secure: false
});
let serve = gulp.series(
build,
done => {
browserSync({
online: false,
open: false,
ghostMode: false,
port: 9000,
logLevel: 'silent',
server: {
baseDir: ['.'],
middleware: [proxy, historyApiFallback(), function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
next();
}]
}
}, function (err, bs) {
let urls = bs.options.get('urls').toJS();
log(`Application Available At: ${urls.local}`);
log(`BrowserSync Available At: ${urls.ui}`);
done();
});
}
);
}
);