# Redirect HTTP requests to /index.html for React app

**URL:** <https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634>\
**Category:** General\
**Created:** [7 November 2019 13:22 UTC](https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634 "2019-11-07T13:22:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![episensor](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@episensor](https://discourse.nodered.org/u/episensor)\
**Post date:** [7 November 2019 13:22 UTC](https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634/1 "2019-11-07T13:22:28Z")

</div>

Hi All,

If Node-RED is used to host a single page React webapp as static content at a top level domain, with an api running at /api, is it possible to redirect all non-API requests back to /index.html so they can be processed by the single page app?

Thanks

---

<div class="post-metadata">

**Author:** ![RoganFPS](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roganfps/32/3208_2.png) [@RoganFPS](https://discourse.nodered.org/u/RoganFPS)\
**Post date:** [7 November 2019 14:24 UTC](https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634/2 "2019-11-07T14:24:48Z")

</div>

like a middle ware? You'd have to pass each request through a function node with your middle ware logic inside of it.

---

<div class="post-metadata">

**Author:** ![episensor](https://avatars.discourse-cdn.com/v4/letter/e/e9bcb4/32.png) [@episensor](https://discourse.nodered.org/u/episensor)\
**Post date:** [7 November 2019 15:27 UTC](https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634/3 "2019-11-07T15:27:22Z")

</div>

it would be straightforward to set up a redirect inside Node-RED, but with httpNodeRoot set to /api in settings.js we can only capture requests to /api endpoints inside Node-RED.

httpStatic serves content from the top level, so I'm thinking it would need an additional config applied to the express webserver?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 November 2019 19:22 UTC](https://discourse.nodered.org/t/redirect-http-requests-to-index-html-for-react-app/17634/4 "2019-11-07T19:22:08Z")

</div>

Have a look at uibuilder and see if that helps. You can use it with REACT.
