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.
Created 09-09-2024 01:22 PM
@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
Created on 09-10-2024 03:23 AM - edited 09-10-2024 03:26 AM
Hi @MattWho ,
Let me re frame my question like this.
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.
Created 09-12-2024 02:03 PM
@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:
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
Created 09-16-2024 12:33 AM
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.
Created 09-17-2024 08:10 AM
@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:
You'll see two custom headers (displayName and outerID) added above as dynamic properties.
HandleHTTPRequest processor:
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.
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