I everyone. I'm very new to Nginx. My situation is like this.
I have a Php application which that handles both backend and front-end, and also I have another ReactJs application as a micro-frontend service. I'm using a Docker container for the Nginx service.
Currently, domains are like this;
Php application - https://my.happy.customers.local
ReactJs - http://my.happy.customers.profile.local
What I want to achieve here is, whenever customers when to https://my.happy.customers.local/user/1234567989/profile
url I want to send users to http:///my.happy.customers.profile.local:3001/user/1234567989/profile
url.
All the cookies and local-storage values are bound to the https://my.happy.customers.local
domain, so I want to use them from the second domain too.
How can I do this??
I managed to redirect url but in that way, I'm losing all cookies.
location ~ ^/(user)(/.*)(/profile)(/.*) {
rewrite ^/(user)(/.*)(/profile)(/.*)$ http:///my.happy.customers.profile.local:3001$request_uri redirect
}
If I can redirect the user to the micro-frontend without changing the url, it will be great. Is this possible?
I tried this way but it's giving me an error.
location ~ ^/(user)(/.*)(/profile)(/.*) {
resolver my.happy.customers.profile.local;
proxy_pass http://my.happy.customers.profile.local:3001$request_uri
}