Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Setting up development proxy server

StsjeJan 31 2020 — edited Jan 31 2020

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

    });

  }

);

  }

);

Comments
Post Details
Added on Jan 31 2020
1 comment
346 views