rmbolger / Posh-IBWAPI

PowerShell module for interacting with the Infoblox WAPI (REST API).
MIT License
54 stars 8 forks source link

Auto-follow master candidate "meta refresh" responses #21

Closed rmbolger closed 6 years ago

rmbolger commented 6 years ago

In the default configuration, web requests to a grid master candidate result in a standard HTML response that redirects to the current grid master using a meta refresh tag like this:

<META HTTP-EQUIV="REFRESH" CONTENT = "0; URL=https://xxx.xxx.xxx.xxx"/>

For web browsers, this is fine because they understand the tag and will automatically go to the redirected page. But things like Invoke-RestMethod won't. So if your environment is in a state that is currently failed over to a grid master candidate. Anything configured to talk to the grid master via this module will fail.

It would be nice if the module was able to recognize and parse the meta refresh tag and re-send the request to the current grid master.

It would be nicer if Infoblox changed how they do redirects to using something like an HTTP 301 response.

rmbolger commented 6 years ago

Added in d881c9f7cabc9fb44c4d95898ab5b429bfea872e.

An interesting observation I noticed while testing. NIOS only seems to send the meta refresh response on GET and POST requests. PUT and DELETE requests result in a '503 Forbidden' response which is oddly inconsistent.