0

I recently had a load balancer added in front of my website. The loadbalancer will make a HEAD / request, and expect a 200 ok.

Unfortunately, no matter what I do I'm faced with a 302 redirect (to whatever default controller i specify).

This causes the load balancer to believe the website is down. Unfortunately the load balancer is not something I can configure, or otherwise change behavior.

Quite simply, Whenever a HEAD / request is issued, I would like to return 200 ok. Preferably only for HEAD requests, to make the load balancer happy.

Any suggestions or ideas for how to do this?

Smilie
  • 13
  • 3
  • Perhaps a custom controller and route as described here: https://stackoverflow.com/questions/8329101/responding-to-head-request-in-asp-net-mvc-3 – stephen.vakil Sep 15 '17 at 15:16
  • I tried this, but the call is still routed/redirected, and is not answered immediately. – Smilie Sep 18 '17 at 06:48

1 Answers1

0

I haven't had to use this for a load balancer, but you might look at using [HttpHead]. It should be used just like specifying a post action. It might look something like the following:

[HttpHead]
public ActionResult Index()
{
    return View();
}
Joshua Morgan
  • 678
  • 6
  • 18
  • While this will allow me to only act upon head requests, it wouldn't allow me to answer directly to a request, rather than re-routing the call first. – Smilie Sep 18 '17 at 06:49