Hi,
I'm having an issue using Apache HTTP Components Proxy Configuration to connect to our proxy using AEM 6.3. Using HTTPClient 3.x code I am able to access the proxy without issue using Day Commons HTTP Client 3.1. However switching the code to org.apache.httpcomponents 4.x I am not hitting the proxy using Apache HTTP Components Proxy config using the same proxy parameters. Are there any other settings that may need to be updated to make this connection work? Is there a specific version of httpcomponents that I need to use?
Solved! Go to Solution.
Hi Michael,
Two things to check:
1) Make sure that you've configured your proxy settings in the Apache HTTP Components Proxy Configuration factory and not the plain PID
2) Use the HttpClientBuilderFactory (org.apache.http.osgi.services.HttpClientBuilderFactory) service to get a HttpClientBuilder
Hi Michael,
Two things to check:
1) Make sure that you've configured your proxy settings in the Apache HTTP Components Proxy Configuration factory and not the plain PID
2) Use the HttpClientBuilderFactory (org.apache.http.osgi.services.HttpClientBuilderFactory) service to get a HttpClientBuilder
Hi Joseph,
Thanks for the response. Unfortunately I believe I've tried those with no luck. Just double-checking though on the Proxy Configuration. For factory, do you mean create a new factory configuration (+ next to configuration in italics) rather than update the primary factory?
Thanks,
Mike
Views
Replies
Total Likes
Yep, that's what I mean
Views
Replies
Total Likes
Can you share a screenshot of your configuration (scrub the sensitive details) and a code snippet?
Views
Replies
Total Likes
Sure just running a simple HTTP GET to google: AEM log shows the GET itself is successful. I have a apache proxy running on localhost (screenshot attached). Viewing the apache access log I can see there is no connection through the proxy.
public class CustomStep implements WorkflowProcess
{
/** Default log. */
protected final Logger log = LoggerFactory.getLogger(this.getClass());
//Inject a HTTP Factory Service
@Reference
private HttpClientBuilderFactory httpFactory;
public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException {
try
{
log.info("Here in execute method"); //ensure that the execute method is invoked
String url = "https://www.google.com";
HttpClient client = httpFactory.newBuilder().build();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
log.info("Response Code GET GOOGLE : "
+ response.getStatusLine().getStatusCode());
Views
Replies
Total Likes
Hi Joseph,
Actually you're configuration settings did work! For some reason the apache logs with this configuration showed a 5 min delay. Thanks again for your help!
Views
Replies
Total Likes
Great
Views
Replies
Total Likes
Views
Likes
Replies