Disable following redirects in httpGet call?


It appears that httpGet and its async versions will attempt to follow redirects. Is there a way to turn this behavior off via params? I need access to the headers of the redirect response itself rather than attempting to follow the redirect. Thanks.



I had the same question here.

I gave @chuck.schwer a potential solution I think. The groovy methods for GET, POST, PUT, etc. don't allow configuration to stop automatic redirect directly. However, I think each one has the ability to request the underlying http client which does have that functionality.

Anyway, I'm in the same boat. I need some cookies that were set in a redirect response. Alternatively I need a session so that cookies are stored from all responses and I don't have to do any of it manually. The Python session is handy. Not a lot of languages have a sweet, quick and easy session implementation though.

Just out of curiosity, what are you trying to do? I want to log into Comcast's internet usage page and scrape my internet usage for the month so I can display it as a RYG light in the kitchen. That way my wife can use it to slow the dang kids down on the Netflix usage if we're getting close to cap.

I HATE YOU, COMCAST. (I'm doing the middle finger to the air for emphasis.)


@codahq I'm trying to retrieve the captured image from a motion camera in my Abode system, following the same approach that the abodepy Python library uses (abodepy/camera.py at master · MisterWil/abodepy · GitHub). Unfortunately, trying to automatically follow the redirect results in a 403 error from AWS due to an invalid signature (it redirects to an S3 bucket URL, and apparently the signature needs to exactly match headers, etc., which it doesn't). So what I really want is just the raw location header (i.e., the S3 URL) rather than being auto-redirected there.