Title: Serve React on IIS with MVC C# Web.Api backend
Tags: asp.net-mvc;reactjs;iis-7;react-router
Question: I have created a React project (using create-react-app), which communicates to a MVC C# web api 2 Backend. Everything works fine in development, using the React Proxy.
I now want to move to a production site. The production site is using IIS 7. All my MVC C# controllers have the url /api/*.
What I believe I need to do, is for IIS to redirect all calls to the react index.html file if /API/ is not in the route. This way the react router can handle the routing. Any calls to the server will have the prefix /api/ and this is where MVC should route the call to the controller.
I'm not sure how I can achieve this.


Here is another answer: My solution was to use IIS to rewrite all urls that weren't in /api/* /content/* /static/* to the react index.html file.
Solution here:
IIS rewrite condition for React MVC App

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2018:00:03/31/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<asp.net-mvc><reactjs><iis-7><react-router>', 'Title': 'Serve React on IIS with MVC C# Web.Api backend', 'ViewCount': 1000, 'id': 49588688, 'user_AboutMe': '<p>C#, SharePoint, Angular/React software developer.</p>\n<p>Director at <a href="https://hotsnail.com.au" rel="nofollow noreferrer">HotSnail</a></p>\n', 'user_AccountId': 679719.0, 'user_DisplayName': 'Michael', 'user_Reputation': 7677.0, 'user_Views': 402.0, 'user_id': 902012.0}}