Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Header request attributes not being passed with NiFi as api gateway

avatar
Explorer

We are using nifi as api gateway. Whenever we pass any attributes in request header it should be captured as http.headers.xxxx in flowfile but when checked in flowfile ; header value is coming in small case though we have passed it in caps. In our implementation we have 2 instances of nifi running. One instance doesn't have any issue where as other has .

Please help if there is any configuration I'm missing. 

5 REPLIES 5

avatar
Master Mentor

@Chetan_mn 

Details are very beneficial in getting assistance in the community.

Why different NiFi instance would produce two different FlowFile attribute contents, makes no sense to me. 

1. Are these two instance of NiFi just  2 nodes in the same NiFi  cluster?
2. What version(s) of NiFi are being used?
3. What processor is being used to your http requests?  I am assuming the HandleHttpRequest processor.
4. How is the HTTP processor configured?
5. Can you share a sample http request?
6. What is the source generating the request?  Is it an automated process?

Thank you,

Matt

avatar
Explorer

Hi @MattWho ,

Let me re frame my question like this.172596351627675552290015234241.jpg

When API call is made to nifi where handleHttprequest accepts http requests,

There are few attributes in request header (Example: "displayName"). These 

Requests are received at handleHttprequest processor. When I check attributes of 

Flowfile, I could see "http.headers.displayname" . Letter 'N' turned into lower case.

But I need this to be in original form( http.headers.diplayName).

We are currently on 2.0 M2.  Is there any configuration I'm missing due to which

Request headers are turning into small case.

17259636137353263954944195229608.jpg

avatar
Master Mentor

@Chetan_mn 

While I do not have an install currently of Technical Preview NiFi 2.0 milestone2 release, I used a NiFi 1.18 to build a simple dataflow using HandleHTTPRequest.

I then setup an invokeHTTP processor to send a message to  to that api endpoint using the PATCH http method. I also include a couple custom headers:

displayName=Display1
outerID=123456aBcD

When I inspected the received FlowFile from HandleHTTPRequest, I see the FlowFile attributes created from the headers look correct:

MattWho_0-1726174713292.png

I suggest you try using an InvokeHTTP processor to test your HandleHTTPRequest processor in Apache NiFi 2.0.0-M2  to make sure your issue is not the result of some external manipulation of the headers before they are received by the HandleHTTPRequest processor.

The headers are just create as FlowFile Attribute property names.  I am curious how the all lowercase of these property names are impacting your dataflow?

Are the values for your headers being modified?

Please help our community grow. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt





avatar
Explorer

Hi @MattWho ,

I tried with invoke http. I made call to handleHttprequest . Issue still present. Doesn't look like any other

External factors are affecting the header case. 

 

In our implementation we read those flowfile attributes (which came as headers)

In execute scripts. Which are giving error now. 

avatar
Master Mentor

@Chetan_mn 
I loaded up the latest NiFi-2.0.0-M4 (milestone 4 release).
Loaded up my flow definition used in my NiFi 1.23 version.

All seems to work fine sending headers with mix case and seeing the correct attributes created with those mix case headers on FlowFile generated by HandleHTTPRequest processor.
InvokeHTTP:

MattWho_0-1726585335926.png

You'll see two custom headers (displayName and outerID) added above as dynamic properties.

HandleHTTPRequest processor:

MattWho_1-1726585431368.png

When I "List Queue" on the connection containing the "Success" relationship from HandleHTTPRequest processor and "view details" the queued FlowFile, the FlowFile attributes look correct.

MattWho_2-1726585571571.png

MattWho_3-1726585646508.png

Are you saying you see different?
Try using NiFi 2.0.0-M4 (latest) to see if experience is same.

At what point in your dataflow are you checking the validating the FlowFile Attributes.
Is your custom script maybe handling them wrong?
I am not seeing an issue in the HandleHTTPRequest processor with regards to HTTP Header handling.

Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.

Thank you,
Matt