There is currently an app that is using cname host mapping with a third party app
the hostname for the third party app is mycompany.partner.com
and the current cname host map under my domain help.mycompany.com
so current routing is below
users => cloudflare DNS(help.mycompany.com) => cname host mapping(mycompany.partner.com) => partner app
now i want to do this
=> cname host mapping(mycompany.partner.com) => partner app
|
users => cloudflare DNS(help.mycompany.com) => my nginx => |
|
=> my frontend app
is this possible?
So basically i want all traffic to come to my own app via nginx now and then i route some traffic based on url path to the third party app and others to my frontend app
how can i achieve this with nginx? below are the url paths i want to route
this routes to my frontend app
help.mycompany.com/app/test1 => http://localhost:500/app/test1
help.mycompany.com/app/test2/test3 => http://localhost:500/app/test2/test3
help.mycompany.com/app/parameter?key=check => http://localhost:500/app/parameter?key=check
this rewrites/routes to partner app
help.mycompany.com/app/partner1 => https://mycompany.partner.com/app/partner1
help.mycompany.com/app/discuss/check => https://mycompany.partner.com/app/discuss/check
and all other paths
location block to route all url paths to the frontend app is below
location ^~ / {
rewrite ^/(.*)$ /$1 break;
proxy_pass http://localhost:500;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
but now i need to split some url paths to the partner app as stated above
so basically all traffic will pass through nginx as i will point DNS for help.mycompany.com to now point to my nginx reverse proxy and then routes and rewrites the url
Thanks