How to configure proxy settings for a website in production

I created a website in angular and have the following proxy settings in the proxy.conf.js file.

const proxyConfig = [
  {
    context: '/web/api/webclients/**',
    target: 'https://10.109.102.109',
    changeOrigin: true,
    secure: false
  },
  {
    context: '/restful/**',
    target: 'https://10.109.110.190',
    changeOrigin: true,
    secure: false
  },
  {
    context: '/api/**',
    target: 'http://10.109.105.107',
    changeOrigin: true,
    secure: false
  }
];

proxy.conf.js works as expected in design mode.

I have them in the package.json file to start and build.

"build": "ng build --aot --prod",
"start": "ng serve --proxy-config proxy.conf.js -o",

After running "npm run build" and using the provided files to host the website in IIS 8, the pages that should use the proxy settings do not work.

For example, my request https: // localhost / web / api / webclients / authentication should go to https://10.109.102.109/web/api/webclients/authentication

- IIS, Windows -, , Windows?

+4

Source: https://habr.com/ru/post/1662969/


All Articles