Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

HandleHttpRequest runs twice if requested from browser (Chrome, Firefox)

avatar

Hi,

I need to handle an HTTP request and I need to respond an HTML file with NiFi.

My flow is like

HandleHttpRequest -> ExecuteSQL -> HandleHttpResponse.

I need to query our database to show proper HTML result.

My problem is HandleHttpRequest runs twice for each request when triggered by browsers such as Chrome, Firefox. HandleHttpRequest runs once if I use Postman or SoapUI.

I've tried to eliminate the second call by using HashContent and DetectDuplicate but it makes some of our requests fail. I've investigated the issue and I've found that Chrome and Firefox creates an additional request for displaying favicon and sometimes some other reasons. (Link)


I need to find real request and I need to eliminate other requests. The real request can be the second one depending on the browser status. Browser decides when to create new requests and their orders.


So, my question is how can I run my flow exactly one time when user creates request from their browser? Because I do some operations on the database and second call ruins these operations.


Thanks.

1 ACCEPTED SOLUTION

avatar

I've fixed it by using RouteOnAttribute to http.request.url attribute.

View solution in original post

2 REPLIES 2

avatar

I've investigated a bit more and I've found this.

"http.request.url" attribute has an "http://localhost:8011/favicon.ico" value for one of them and the other one has "http://localhost:8011".

avatar

I've fixed it by using RouteOnAttribute to http.request.url attribute.