RequireHttps Attribute doesn't work in ASP.NET MVC3 on AppHarbor

philiprichardson's Avatar


11 Apr, 2011 12:04 AM

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:

    public ActionResult Login(FormCollection collection)
        return RedirectToAction("Index", "Home", null);

- 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.


  1. Support Staff 1 Posted by rune on 12 Apr, 2011 04:42 PM

    rune's Avatar

    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:

    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.


  2. rune closed this discussion on 12 Apr, 2011 04:42 PM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac