akamai / NetStorageKit-Java

Apache License 2.0
19 stars 28 forks source link

UnknownHostException when using Credential Hostname with path #31

Open Irfanovic opened 4 years ago

Irfanovic commented 4 years ago

Hello,

I am using the SDK for uploading to netstorage through an API Manager with an URL such as this one:

devUrl.apim.company.com/netstorage

( The APIM is configured to redirect to an akamai URL(myhostname.akamaihd.net). ) This URL is used as the hostname when constructing the Credential object, however it seems like the path(/netstorage) is kept when calling Netstorage, since I am getting UnknownHostExceptions.
Directly calling the HTTP API without the SDK with the above URL works without any issues.

Thanks in advance

vladonemo commented 4 years ago

We use it by deriving from the NetStorageCMSv35Signer where in the execute method we open the http connection explicitly. There you open the connection to your proxy. But you construct the NetStorage with the original hostname. It's hack but there doesn't seem to be a better way.