Skip to content

proxy config instructions don't work #12720

Closed
@Yahkob

Description

@Yahkob

Steps to reproduce

  1. npx create-react-app proxy-text
  2. npm install http-proxy-middleware --save
  3. create setupProxy.js with contents
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'http://google.com',
      changeOrigin: true,
    }),
  );
};
  1. add useEffect to App.js with fetch to `/api':
  useEffect(() => {
    fetch('/api?s="test')
  }, [])
  1. start app, inspect network

The requested URL /api was not found on this server. That’s all we know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions