[wp-trac] [WordPress Trac] #54556: It's impossible to get 'location' header on 302 redirect of wp_remote_post
WordPress Trac
noreply at wordpress.org
Mon Oct 6 15:59:30 UTC 2025
#54556: It's impossible to get 'location' header on 302 redirect of wp_remote_post
--------------------------+------------------------------
Reporter: saturnix2025 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution: worksforme
Keywords: | Focuses:
--------------------------+------------------------------
Changes (by mindctrl):
* keywords: reporter-feedback =>
* status: new => closed
* resolution: => worksforme
Comment:
Hi all,
I've tried to replicate the issue, but it works as expected for me on WP
6.8.3.
Here is my environment info:
{{{
=== Environment
- WordPress: 6.8.3
- PHP: 8.4.10
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.4.10)
- Browser: Chrome 140.0.0.0
- OS: macOS
- Theme: Twenty Twelve 4.6
- MU Plugins:
* z.php
- Plugins:
* Test Reports 1.2.0
=== Actual Results
1. ❌ Error condition does not occur.
=== Additional Notes
Nginx config:
location = /trac54556 {
return 302 /new-trac54556;
}
location = /new-trac54556 {
return 200 "Hi";
}
Code used to confirm redirect URL is returned:
$response = wp_remote_get( "http://vanilla.local/trac54556", [
'redirection' => 0 ] );
$redirect_to = wp_remote_retrieve_header( $response, 'location' );
echo '<pre>$redirect_to<br>' . print_r( $redirect_to, true ) . '</pre>';
Returns: http://vanilla.local:10008/new-trac54556
}}}
Since this ticket has been opened for ~4 years with no other reports, I'm
going to close this to help clean up Trac. If this is still an issue for
you, please feel free to reopen and provide any environmental information
necessary to reproduce.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54556#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list