Skip to content

Commit

Permalink
Changed RequireHttpsAttribute to default to 302 instead of 301
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang authored and kichalla committed May 3, 2016
1 parent 3aa4261 commit f4679fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Mvc.Core/RequireHttpsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected virtual void HandleNonHttpsRequest(AuthorizationFilterContext filterCo
request.QueryString.ToUriComponent());

// redirect to HTTPS version of page
filterContext.Result = new RedirectResult(newUrl, permanent: true);
filterContext.Result = new RedirectResult(newUrl, permanent: false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void OnAuthorization_RedirectsToHttpsEndpoint_ForNonHttpsGetRequests(
Assert.NotNull(authContext.Result);
var result = Assert.IsType<RedirectResult>(authContext.Result);

Assert.True(result.Permanent);
Assert.False(result.Permanent);
Assert.Equal(expectedUrl, result.Url);
}

Expand Down Expand Up @@ -216,4 +216,4 @@ private static IServiceProvider CreateServices(int? sslPort = null)
return services.BuildServiceProvider();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public async Task ActionWithRequireHttps_RedirectsToSecureUrl_ForNonHttpsGetRequ
var response = await Client.GetAsync("Home/HttpsOnlyAction");

// Assert
Assert.Equal(HttpStatusCode.MovedPermanently, response.StatusCode);
Assert.Equal(HttpStatusCode.Found, response.StatusCode);
Assert.NotNull(response.Headers.Location);
Assert.Equal("https://localhost/Home/HttpsOnlyAction", response.Headers.Location.ToString());
Assert.Equal(0, response.Content.Headers.ContentLength);
Expand Down

0 comments on commit f4679fe

Please sign in to comment.