I have 2 websites php and reactjs
- php site running on http://localhost
- react site running on http://localhost:3000
I'd like to access http://localhost:3000/funds page when user visit URL http://localhost/funds. I tried with apache proxy but it is showing blank react site as images and css missing on path. Any other suggestion to achieve this, Thanks.
ProxyPass /funds http://localhost:3000/funds
ProxyPassReverse /funds http://localhost:3000/funds
My Answer:
One possible solution is to use a reverse proxy in your Apache configuration to serve the ReactJS site. Here's an example configuration that you can add to your Apache virtual host file:
ServerName localhost
ProxyPass /funds http://localhost:3000/funds
ProxyPassReverse /funds http://localhost:3000/funds
ProxyPassReverse /
ProxyPreserveHost On
ProxyPassReverseCookieDomain localhost localhost
ProxyPassReverseCookiePath / /
This configuration sets up a reverse proxy for the `/funds` path to the ReactJS site running on `http://localhost:3000/funds`. The `
Make sure to restart Apache after making these changes for them to take effect. This should allow you to access the ReactJS site at `http://localhost/funds` with the correct images and CSS paths.
Rate this post
5 of 5 based on 6925 votesComments