Hi Joe:
I was looking at the InvokeHttp code and I can work on enhancing the 3xx issue
based on the pattern for handling other statuses. However, I would like to add
a newbie caveat here.
Let me know if that would help.
Thanks
Mans
On Sunday, November 8, 2015 8:44 PM, M Singh <[email protected]> wrote:
Hi Joe:
You are right - setting follow-redirects did not work and I did mix retry with
redirect.
I will wait for your enhancements.
Thanks again for your help.
On Sunday, November 8, 2015 8:31 PM, Joe Percivall
<[email protected]> wrote:
Hello,
Firstly, I think you're mixing up "retry" and "redirect". The 3xx status code
is for redirecting to another url and 5xx is to try again. The property we have
is "Follow Redirects". Retrying doesn't involve a location header but the
redirect does. That being said, I did a bit of digging I don't think InvokeHttp
was handling redirects properly. All we were doing was setting the
"setInstanceFollowRedirects" to true, which according to this site [1] doesn't
fully handle it.
I am going to attach a patch to ticket 1086[2] tonight for InvokeHttp's
refactor to use OkHttp instead of HttpUrlConnection. If you'd like to test that
out and see if that it solves the redirect and location header problem that
would be awesome.
[1] http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/
[2] https://issues.apache.org/jira/browse/NIFI-1086
Joe
- - - - - -
Joseph Percivall
linkedin.com/in/Percivall
e: [email protected]
On Sunday, November 8, 2015 9:53 PM, Joe Witt <[email protected]> wrote:
Joe P,
Do you have any other recommendations light of the work you're doing
now to Invoke HTTP?
Thanks
Joe
On Sun, Nov 8, 2015 at 9:49 PM, M Singh <[email protected]> wrote:
> Thanks Joe.
>
> When I look at the provenance of the flow file, it shows the status as 301
> as shown below but no Location attribute.
>
> If I curl the url and check the headers it does show the Location attribute.
>
> invokehttp.status.code 301
>
>
>
>
> On Sunday, November 8, 2015 4:58 PM, Joe Witt <[email protected]> wrote:
>
>
> Hello
>
> You can use provenance or a LogAttributes processor to see what the
> headers are of the flow file after InvokeHTTP executes. You may find
> the location header present as one of the attributes. If so then you
> should be able to use that attribute to establish the URL it will hit
> next time. Does that help?
>
> Thanks
> Joe
>
> On Sun, Nov 8, 2015 at 7:51 PM, M Singh <[email protected]> wrote:
>> Hi:
>>
>> I am trying to use InvokeHTTP and have set the follow-retry to true, and
>> have associated a self referencing relation for the InvokeHttp for
>> no-retry
>> (1xx, 2xx, and 3xx) and retry (5xx) relations. But it looks like it
>> retires
>> only status 500 codes requests and for 3xx does not pick up the Location
>> header for retrying.
>>
>> However, since I am new to nifi - I might be missing something or using
>> the
>> wrong settings or wrong processor.
>>
>> If anyone has any suggestion, please let me know.
>>
>> Thanks
>>
>
>