Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy config instructions don't work #12720

Closed
Yahkob opened this issue Sep 9, 2022 · 0 comments
Closed

proxy config instructions don't work #12720

Yahkob opened this issue Sep 9, 2022 · 0 comments

Comments

@Yahkob
Copy link

Yahkob commented Sep 9, 2022

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant