Discussion

1
Replies
2103
Views
josenavas Member since 2013 26 posts
Hoverstate
Posted: 4 years ago
Last activity: 4 years 7 months ago
Closed

Send custom HTTP header

Hi,

We have a requirement to send a custom header for authorization, for example a header with name "token". This needs to work seamlessly together with the action "Open URL in Window" that is available for links in a Repeat Grid.

We've tried adding a extra action "Run Activity" before the Open URL in Window, that will run an activity with this Java code:

String token = "";
String authToken = "$2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a";
client = org.apache.http.impl.client.HttpClients.custom().build();
org.apache.http.client.methods.HttpUriRequest request = org.apache.http.client.methods.RequestBuilder.get().setUri(DocumentURL).setHeader(token, authToken).build();
response = client.execute(request);

Like you see in the code above, we set the custom header with "setHeader(token, authToken)", but once we click the link, we notice* the custom header is not being passed over to the DocumentURL we specified...

*We used Firefox's Live HTTP headers extension to monitor the header information that is being sent over

Since I think Pega 7.1.8 does not have a OOTB way to send custom HTTP headers... Any idea for a workaround for this problem?

Thanks,

Jose

 

 

 

Moderation Team has archived post
Share this page LinkedIn