question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to config React frontend application completely dev-server proxy?

See original GitHub issue

Current Behavior

I only have an React frontend application completely, backend API is separated from my frontend application, I hope forwarding interface fetching to backend API such as: forward /api to http://domain3.domain2.com/path/api, but I can’t find any solution to solve this?

Expected Behavior

forwarding interface fetching to backend API

Steps to Reproduce

github’s project address

$ yarn start nx-demo

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
FrozenPandazcommented, Jun 5, 2020

Hi there, this is already available. 😃

In your project’s serve configuration you can add:

            "proxyConfig": "apps/app1/proxy.conf.json"

And such file looks like the following:

{
  "/api": {
    "target": "http://localhost:3333",
    "secure": false
  }
}
0reactions
pjw9963commented, Jun 1, 2022

Does anyone have a work around for this? Kinda important for my builds to use the production api url

Read more comments on GitHub >

github_iconTop Results From Across the Web

React — How To Proxy To Backend Server - Medium
Let's start the server with this command npm run dev and test this API on port 3080.
Read more >
Proxying API Requests in Development - Create React App
Configuring the Proxy Manually​ ... Note: this feature is available with react-scripts@2.0.0 and higher. If the proxy option is not flexible ...
Read more >
Why You Should Use React DevServer Proxy - Bits and Pieces
There are two main ways to set up DevServer Proxy for a React frontend. You can choose either one based on what you...
Read more >
Why you should use a proxy server with Create React App
Learn why and how to implement a proxy server with Create React App to secure and organize your next React app.
Read more >
Using the proxy setting for React dev server | protips
Quite simply - if you request something that is not in your React application (unknown resources), the React Development server will forward the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found