'Nginx reverse proxy to a specific page

I need to set up a reverse proxy to pass all requests for accounting.mycompany.com to a very specific page on our website - https://www.mycompany.com/something/accounting/.

I've tried

  proxy_pass https://www.mycompany.com/something/accounting/; 

but the page isn't displayed properly, the formatting is broken. If I just redirect to a main page everything looks fine.

  proxy_pass https://www.mycompany.com/;

On the main site https://www.mycompany.com/ we have this config for http

location / {
                rewrite ^/(.*)$ https://$host/$1 permanent;
                    }

and this for https

location / {
          proxy_pass   http://127.0.0.1/;
     }

I'm confused, how to put all of this together so it would work properly?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source