Skip to content

Commit

Permalink
fix: send set-cookie headers in redirects (#7258)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet authored Aug 29, 2022
1 parent 32d5baf commit 202070c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ sub redirect_to_url($request_ref, $status_code, $redirect_url) {
$r->headers_out->set(Location => $redirect_url);

if (defined $request_ref->{cookie}) {
$r->headers_out->set("Set-Cookie" => $request_ref->{cookie});
# Note: mod_perl will not output the Set-Cookie header on a 302 response
# unless it is set with err_headers_out instead of headers_out
# https://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_err_headers_out_
$r->err_headers_out->set("Set-Cookie" => $request_ref->{cookie});
}

$r->status($status_code);
Expand Down

0 comments on commit 202070c

Please sign in to comment.