'Why is this middleware proxy not working with ASP and React?

I'm making an app with ASP.net and ReactJS, where I have an API to get a bunch of polls located at localhost:7027/Poll/api/polls , and my react is running on localhost port 3000.

When I am trying to access the API, I am getting a CORS violation, and this I suspect this is the culprit:

    (node:58924) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:58924) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(node:58924) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

I've been trying to search online for any fixes, but to no avail has any concrete solution been found.

For reference, my API call in React:

  useEffect(() => {
        pollService.getAllPolls().then((response) => {
            setPolls(response.data)
            console.log(response.data);
        }).catch(error => {
            console.log(error);
        })
    })

My setupProxy.js

const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
    app.use(createProxyMiddleware('/Poll/', { target: 'https://localhost:7027', changeOrigin: true, }));
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source