Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

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

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

  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

Generic

? 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