according to the codex the default redirect for wp_login_form() is:
'redirect' => home_url( $_SERVER['REQUEST_URI'] )
which seems like it ought to bring you right back to the page you are currently on.
but if i log in from this example page:
i get redirected to:
which predictably 404s
site.com/test is the home_url but then /test/product-category/widgets gets returned as the $_SERVER['REQUEST_URI']