I have a problem with the implementation of such redirect:
https://domain.a/ => https://domain.b/foo/ without changing a url to domain.b. I would like to see the contents of the URL domain.a from domain.b/foo/ in browser address bar.
Using proxy pass might works for you
server { listen 80; server_name domain.a; location / { proxy_pass https://domain.b/foo; } } Please check the example below :
server { listen 443; server_name domain.a domain.b; rewrite ^/(.*)$ https://domain.a/ permanent; //Rest of your nginx configuration } It could be simply achieved by return as well.
location /{ return 301 https://domain.b/foo/; }