Using a custom version of the App Engine app on Android

I am trying to use a different version of the App Engine app than the default app in an Android app. The default App Engine version is 1 and I have downloaded the new version 2 and want to test it with an Android app.

The default root path to the application instance looks like this:

xxx.appspot.com

      

Both instances are available (or should be) using:

https://1.xxx.appspot.com    // version 1
https://2.xxx.appspot.com    // version 2

      

The first problem is browser testing. In Chrome, you cannot check it because of the error message Your connection is not private

. Similar to the certificate question for *.appspot.com

:

NET::ERR_CERT_COMMON_NAME_INVALID

      

You can bypass this with Firefox and add this site as a trusted site. So, let's say the second version is tested through a browser, time to test it with an Android app.

I changed the endpoint root url, passing the new url to the builder:

builder.setRootUrl(https://2.xxx.appspot.com);

      

Failure:

java.io.IOException: Hostname '2.xxx.appspot.com' was not verified
     at com.android.okhttp.Connection.upgradeToTls(Connection.java:1026)
     at com.android.okhttp.Connection.connect(Connection.java:963)
     at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:405)

      

A quick search on SO and there is a quick and dirty solution (I would not use this in production, not even test the application. Of course, hostname validation should be done, for example, with the standard verifier, and if the default returns false using my fallback verifier ):

HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
    @Override
    public boolean verify(String hostname, SSLSession session) {
        return true;
    }
});

      

And the end result:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(ProGuard:113)
    at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.set(ProGuard:40)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(ProGuard:312)

      

No matter which version I use, it ends with 404. The only valid URL: https://xxx.appspot.com

I'm sure the method I'm trying to call exists in the endpoint because I can call it using Firefox.

Any suggestions for testing a new version of the App Engine app with an Android app? Is the certificate validation error a bug, or is this correct behavior that *.appspot.com

only matches xxx.appspot.com

but does not match x.xxx.appspot.com

?

+3


source to share


1 answer


Apparently the solution was in the documentation:

Please note that in April 2013 Google stopped issuing SSL certificates for double-lookup domains hosted on appspot.com (i.e. appspot.com). If you rely on such URLs for HTTPS access to your application, please change any application logic to use "-dot-" instead of "." For example, to access version "1" of "myapp" uses " https://1-dot-myapp.appspot.com " instead of " https://1.myapp.appspot.com ." If you keep using " https://1.myapp.appspot.com " the certificate will not match, which will result in an error for any User-Agent that expects a URL and the certificate matches exactly.



In short, I had to replace 2.

with2-dot-

+5


source







All Articles