Request post fails when using proxy url


#1

Hi,

Url: https://us-try.count.ly/i?
Post request fails with proxy settings

When I am connected to internet in office network, using LAN Settings -> Use automatic configuration script -> 'Proxy url',
Sending data to Countly server fails with an error
'java.net.ConnectException: Failed to connect to us-try.count.ly/35.188.183.245:443'

If I change the Internet connection to, using LAN Settings -> Automatically detect settings, it works fine.

How to make it work with custom proxy settings?


#2

Hello,
are you able to access Countly dashboard with the same proxy url in browser?


#3

Yes, I can access dashboard.


#4

Hi ar2rsawseen,

Any update on this? :point_up_2:


#5

@arturs_k is there any reason why this URL would not work with Android SDK? Like slash in the middle, etc?


#6

Any update on this? :point_up_2:


#7

Hello. Just to clarify, I have a few questions.

You seem to be using android, could you tell us which device and which android version?

From what you have said, your proxy configuration works if you use auto-config, but it fails if you manually set custom proxy settings.

When using your custom settings, does opening web sites in the browser work?

Which countly version are you using? Could you show us how you init countly in your app? Could you also enable countly logging, use your app and then send us the generated log? This would give a better impression of what is happening internally.


#8

Hi arturs_k,

I am using from desktop java application.
Yes, When using custom settings, I can open web sites in the browser.
Where do I get countly version?
Application Name: ISXD Web, if you can make out version from this.
Init code is here:

		OkHttpClient client = new OkHttpClient.Builder()
        .connectTimeout(2, TimeUnit.SECONDS)
        .readTimeout(2,TimeUnit.SECONDS)
        .writeTimeout(2,TimeUnit.SECONDS).build();
		
		Retrofit retrofit = new Retrofit.Builder().baseUrl("https://us-try.count.ly")
				.client(client)
				.addConverterFactory(GsonConverterFactory.create()).build();

		countlyService = retrofit.create(ICountlyService.class);	

==========
public interface ICountlyService {

@Headers({
    "Accept: application/json",
    "User-Agent: Your-App-Name",
    "Cache-Control: no-cache",
    "content-type: application/json; charset=utf-8"
})
@POST("/i")
Call<Request> logData(@Body Request event);			

==========
Countly logging: Printing response, here is the exception: Is this the one?
java.net.SocketTimeoutException: connect timed out
{"app_key":"123","device_id":"abc","begin_session":0,"end_session":0,"session_duration":120}

at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)

Let me know, If I missed anything.


#9

ok.. you had me confused, because at first I thought that you are using our android sdk :smile: That's why I was asking for the sdk version and the sdk internal logs.

You seem to be making direct requests to the countly server and trying to use our API without any SDK.

The capability of using proxies isn't influenced by the server side, so there seems to be some proxy configuration problem on your side and it's not really something that we can help with.

In your initial message you were showing this error "Failed to connect to us-try.count.ly/35.188.183.245:443" which seems to indicate that you are appending an ip address (maybe your proxy ip) to the target server url which then links to a non existing server endpoint.


#10

Thank you for the detailed response :smile: