[bug] Unable to trigger redirection when the Location Response Header set on the server side
When the Location Response Header set by the server matches the "Include pattern" I configured, the redirection cannot be triggered. At this time, I must manually refresh the browser for the redirect to take effect.
hi @einaregilsson,can you give me a feedback?
Hmmm, if you get a redirect from the server it should trigger a new request by the browser and that request should be redirected I think. Are you using Chrome or Firefox?
I am using Firefox 75.0
Here is a simple URL to use to test this issue:
https://accounts.google.com/
It uses a Location response header with a 302 code.
Don't really have time to work on this now, but when I get back to Redirector I'll look into it.
Okay,looking forward to your return. :smile:
I can confirm this issue using Firefox 90.0b4. Same rule works under Chrome.

Weird, it worked for me, https://mbl.is 301 redirects to https://www.mbl.is and they were both checked by Redirector. Do you have a specific url and redirect I can test this on where it fails?
@einaregilsson I bumped into this issue when a POST API returned 302. So to reproduce it:
<html>
<body>
<form id="test" action="test.php" method="POST">
<label id="test-label"></label>
<input type="text" id="test-input" name="test-input" />
<button id="test-button">Click</button>
</form>
</body>
</html>
<?php
if (!empty($_POST['test-input'])) {
header('Location: https://www.google.com/not/exist', true, 302);
}
exit;
?>
Save the script as e.g. test.php and run php -S 127.0.0.1:8080 in the same directory. Then visit http://localhost:8080/test.php.
Now in Redirector, add the following rule:
Description: Test
Include Pattern: https?://www\.google\.com/not/exist
Redirect to: https://example.com
Type: Regex
Back to test.php, fill in anything, click the button, you'd still see Google.
Exactly the same script & rule work under Chrome.
Hmmm, might be because of the POST, not the 302. Redirector doesn't handle POST requests, and although after you issue a 302 the next request would be a GET it might be related to that. Does it also not work if the original request is a GET?
@einaregilsson It works if the original one is GET. can confirm using https://mbl.is or
<html>
<body>
<form id="test" action="test.php" method="GET">
<label id="test-label"></label>
<input type="text" id="test-input" name="test-input" />
<button id="test-button">Click</button>
</form>
</body>
</html>
<?php
if (!empty($_GET['test-input'])) {
header('Location: https://www.google.com/not/exist', true, 302);
}
exit;
?>