'How to properly setup NGINX proxy_redirect?

Im using subdomain for WP dashboard. Currently I have two proxy_redirect working.Seems like they are working because POST request in wp dashboard goes to uri without any args.

proxy_redirect "https://www.example.com/wp-admin/post.php$is_args$args" "https://dash.example.com/wp-admin/post.php$is_args$args";
proxy_redirect "https://www.example.com/wp-admin/user-edit.php$is_args$args" "https://dash.example.com/wp-admin/user-edit.php$is_args$args";

But this redirect is totally ignored

proxy_redirect "https://www.example.com/wp-admin/admin.php$is_args$args" "https://dash.example.com/wp-admin/admin.php$is_args$args";

Request

 POST https://dash.example.com/wp-admin/admin.php?page=affiliate-wp-payouts&action=new_payout

Returns 302 to main www domain.

location    https://www.example.com/wp-admin/admin.php?page=affiliate-wp-payouts&action=preview_payout&user_name&from=03/01/2022&to=03/04/2022&minimum&payout_method=manual

How to properly use redirects in this case?



Sources

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

Source: Stack Overflow

Solution Source