Repro:
1. Use the RequireHttps attribute on an HttpPost Action
2. Attempt to submit a form to the site over either HTTP or
HTTPs
3. Get a "Sorry, an error occurred while processing your request."
error in the browser.
Action Code:
[HttpPost]
[RequireHttps]
[ValidateAntiForgeryToken]
public ActionResult Login(FormCollection collection)
{
return RedirectToAction("Index", "Home", null);
}
Notes:
- My SSL works fine when the RequireHttps attribute is not included
- Naturally there are scenarios where all developers will want to
restrict HTTP traffic for particular URIs ... so I'd expect it to
work.
Phil
#1 Posted by rune Support staff on 12 Apr, 2011 04:42 PM
Hi Phillip,
Https is terminated at the load balancer level on AppHarbor. You can use the "X-Forwarded-Proto" header to determine whether the client used https. I've made a gist so you can see how you can implement your own RequireHttpsAttribute using that header: https://gist.github.com/915869
Please note that you'll also need to have a certificate associated with the application before it responds to HTTPS traffic.
Let me know if there's anything else we can help with.
Best,
Rune
rune closed this discussion on 12 Apr, 2011 04:42 PM.