(app, path)
| 55 | |
| 56 | // Adds a CORS proxy handler to the application on the given path |
| 57 | export default function addCorsProxyHandler (app, path) { |
| 58 | const corsHandler = cors(CORS_SETTINGS) |
| 59 | const proxyHandler = createProxyMiddleware(PROXY_SETTINGS) |
| 60 | |
| 61 | debug.settings(`CORS proxy listening at ${path}?uri={uri}`) |
| 62 | app.get(path, extractProxyConfig, corsHandler, proxyHandler) |
| 63 | } |
| 64 | |
| 65 | // Extracts proxy configuration parameters from the request |
| 66 | function extractProxyConfig (req, res, next) { |