react-scripts
Version:
Configuration and scripts for Create React App.
22 lines (15 loc) • 639 B
Markdown
with corporate proxy support.
Provide a custom `http.agent` with [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) to connect to the corporate proxy server.
```javascript
var HttpsProxyAgent = require('https-proxy-agent');
var proxy = require("http-proxy-middleware");
// corporate proxy to connect to
var proxyServer = process.env.HTTPS_PROXY ||
process.env.HTTP_PROXY;
var options = {
target: 'http://localhost:3000',
agent: new HttpsProxyAgent(proxyServer)
};
var apiProxy = proxy('/api', options);
```
This example will create a basic proxy middleware