Skip to content

This project tries using react-router-dom for navigation between two different projects, living on the same domain. Nginx is used as a web-server

Notifications You must be signed in to change notification settings

makxca/react-router-nginx-problem

Repository files navigation

React-router-dom for multiple apps on a same domain trouble

I am preoccupied, that if I use Link from react-router-dom for navigation between multiple apps without setting target="_blank", then the navigation will not work, and when I move from /app1/page to /app2/page, although the browser's URL will say I am at /app2/page, the app1 UI will be rendered.

For checking this I created a nginx-server (check nginx.conf) and two apps (check app1 and app2)

Deploy

Prerequisites

Upload to Yandex Cloud

pnpm i
pnpm yc:upload

Deploy to a distant server via ssh

pnpm server:upload

The script will install nginx on the server, download the built app there and start the server. The script will require your username and the ip address of the server. It assumes, that you use ssh-keys for authentication (password authentication is bad).

Results

Yep, as expected. The URL in the browser says I am at /app2, but the app1 UI is rendered.

alt text

About

This project tries using react-router-dom for navigation between two different projects, living on the same domain. Nginx is used as a web-server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published