Skip to content

Commit

Permalink
remove cors verify in openshift
Browse files Browse the repository at this point in the history
  • Loading branch information
usingtechnology committed Nov 28, 2024
1 parent 721022a commit 3a9ee87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 9 additions & 2 deletions app/src/forms/bcgeoaddress/routes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
const cors = require('cors');
const routes = require('express').Router();
const { Development } = require('../common/constants');

const controller = require('./controller');

routes.get('/address', async (req, res, next) => {
// need to allow cors for OPTIONS call (localhost only)
// formio component will call OPTIONS pre-flight
routes.options('/address', cors({ origin: Development.LOCALHOST_ORIGIN }));
routes.options('/advance/address', cors({ origin: Development.LOCALHOST_ORIGIN }));

routes.get('/address', cors({ origin: Development.LOCALHOST_ORIGIN }), async (req, res, next) => {
await controller.searchBCGeoAddress(req, res, next);
});

routes.get('/advance/address', async (req, res, next) => {
routes.get('/advance/address', cors({ origin: Development.LOCALHOST_ORIGIN }), async (req, res, next) => {
await controller.advanceSearchBCGeoAddress(req, res, next);
});

Expand Down
7 changes: 1 addition & 6 deletions app/src/forms/proxy/routes.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
const cors = require('cors');
const routes = require('express').Router();

const { currentUser } = require('../auth/middleware/userAccess');
const controller = require('./controller');

// need to allow cors for OPTIONS call
// formio component will call OPTIONS pre-flight
routes.options('/external', cors());

// called with encrypted headers, no current user!!!
routes.get('/external', cors(), async (req, res, next) => {
routes.get('/external', async (req, res, next) => {
await controller.callExternalApi(req, res, next);
});

Expand Down

0 comments on commit 3a9ee87

Please sign in to comment.