Reputation: 199
Use case:
I am using a java program to purge by CPCode and by URL. Below piece of code is used to connect and purge to Akamai.
credential = ClientCredential.builder().accessToken(Constants.ACCESS_TOKEN).
clientToken(Constants.CLIENT_TOKEN).clientSecret(Constants.CLIENT_SECRET).host(Constants.HOST).build();
transBuilder = new ApacheHttpTransport.Builder();
httpTransport = transBuilder.doNotValidateCertificate().build();
requestFactory = httpTransport.createRequestFactory();
uri = URI.create(“https://control.akamai.com/ccu/v3/delete/cpcode/production”);
requestBody = "{\"objects\": ["+cpCodes+"]}";
request = requestFactory.buildPostRequest(new GenericUrl(uri),ByteArrayContent.fromString("application/json", requestBody));
requestSigner = new GoogleHttpClientEdgeGridRequestSigner(credential);
requestSigner.sign(request);
response = request.execute();
PS: ACCESS_TOKEN, CLIENT_TOKEN, CLIENT_SECRET and HOST are defined in separate Constants.java
String HOST = “akab-tmpyt2prlt4zzld2-zvmyfb6ishptaqxc.purge.akamaiapis.net”;
Issue: This code works fine on my Windows machine (my personal computer i.e. home Wi-Fi) but when I run same code on Linux (client secure network) machine, I get below error: Connect to akab-tmpyt2prlt4zzld2-zvmyfb6ishptaqxc.purge.akamaiapis.net:443 timed out
My Analysis so far:
I can see this says about timeout issue from Linux (client secure network) while from Windows(public network), it never complains about it. I run nslookup command in Linux for this HOST and it runs fine i.e. able to resolve DNS. But when I try wget or curl command on Linux, it says time out issue. I see that my Linux machine is using a proxy to connect to Internet.
Earlier I thought my Linux machine is not able to hit (akab-tmpyt2prlt4zzld2-zvmyfb6ishptaqxc.purge.akamaiapis.net) but then I observed that neither my Windows able to connect (akab-tmpyt2prlt4zzld2-zvmyfb6ishptaqxc.purge.akamaiapis.net). In both cases, I was getting 400 Bad request. So I deduced that these four ACCESS_TOKEN, CLIENT_TOKEN, CLIENT_SECRET and HOST work combined only.
Now I am trying to find where can be the breaking point in Linux. Is there something which I can ask proxy team to add/allow some URL. Please suggest.
Upvotes: 0
Views: 847
Reputation: 66
I am guessing there is a firewall on the Linux side that is blocking the connection to the akamaiapis.net domain. Try using the Akamai CLI, HTTPie or curl from the same Linux machine to see if you are able to make the API call (see examples on https://developer.akamai.com/akamai-101-basics-purging)
If you are able to make the purge API request using any of those CLI tools from the same Linux server that runs your Java code, then you know the problem is on the Java side.
Also the timeout error could mask a different error, I would try printing verbose logging to get more hints of what exactly the error is, as AFAIK the Akamai API response (if you are able to make the API call) will give you some indication of what causes an error
Upvotes: 1