# Redirects broken from update

**URL:** <https://discourse.slimframework.com/t/redirects-broken-from-update/2393>\
**Category:** Questions\
**Created:** [May 8, 2018, 6:21am UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393 "2018-05-08T06:21:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rryyyk](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rryyyk](https://discourse.slimframework.com/u/rryyyk)\
**Post date:** [May 8, 2018, 6:21am UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393/1 "2018-05-08T06:21:46Z")

</div>

so i upgraded from 3.8.1 to 3.10.0  
now all my redirects are broken…  
did i miss the memo? some methods get deprecated or something?

in my auth middleware i check is user logged in and if not do this which used to work…

> return $response-\>withStatus(403)-\>withHeader(‘Location’, ‘/login/’);

all i get now is a blank screen

> $response = $response-\>withStatus(403)-\>withHeader(‘Location’, ‘/login/’);  
> $response-\>getBody()-\>write(‘foo’);  
> return $response;

if i do that i get foo on the screen so there is no redirect happening i think?  
anyone know whats going on? what im doing wrong?

i have no code changes aside from updating dependencies

EDIT:  
so if i rename the vendor directory and put the old one back in it works again…  
if i put it back then request /logout i get the same behavior with a redirect initiated from within a controller

---

<div class="post-metadata">

**Author:** ![rryyyk](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rryyyk](https://discourse.slimframework.com/u/rryyyk)\
**Post date:** [May 8, 2018, 8:15am UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393/2 "2018-05-08T08:15:30Z")

</div>

Ok i figured it out.

its 3.9.0 that has the code change this is what does it:  
[https://github.com/slimphp/Slim/pull/2309/files](https://github.com/slimphp/Slim/pull/2309/files)

in case there is anyone else out there who runs into the same issue

it seems if i do this it works:

> return $response-\>withRedirect(‘/login/’);

but supplying any code makes it fail

> return $response-\>withRedirect(‘/login/’, 403); //200, 201, 400, 401,402,403

can anyone enlighten me as to whats happening here?

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [May 8, 2018, 11:54am UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393/3 "2018-05-08T11:54:32Z")

</div>

@rryyyk You can read the discussion on that change here:

> <https://github.com/slimphp/Slim/issues/1730>

---

<div class="post-metadata">

**Author:** ![rryyyk](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rryyyk](https://discourse.slimframework.com/u/rryyyk)\
**Post date:** [May 9, 2018, 2:40am UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393/4 "2018-05-09T02:40:19Z")

</div>

haha sorry… unlucky for me i read almost to the end of that and didnt see the last comment with the link to the same question as mine before i wanted to go off and look in the code

seems a bit weird you can call a helper method called withRedirect with a parameter set that results in no redirection, though if its up to the browser to follow then i guess there isnt much to be done

is there somewhere in the release notes backwards incompatible changes are listed? im a little concerned of what else might be affected?

if i look at the release for 3.9  
[https://github.com/slimphp/Slim/releases/tag/3.9.0](https://github.com/slimphp/Slim/releases/tag/3.9.0)  
and click the issue there isnt any mention of backwards compatibility  
[https://github.com/slimphp/Slim/pull/2309](https://github.com/slimphp/Slim/pull/2309)

am i looking in the wrong place

---

<div class="post-metadata">

**Author:** ![tflight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/tflight/32/1205_2.png) [@tflight](https://discourse.slimframework.com/u/tflight)\
**Post date:** [May 9, 2018, 11:19pm UTC](https://discourse.slimframework.com/t/redirects-broken-from-update/2393/5 "2018-05-09T23:19:44Z")

</div>

I believe it wasn’t considered a BC break, but rather a bug. Browsers will only follow the `location` header if the status code is 3xx. When using `withRedirect` it is assumed that you care more about the redirect than the status code.
