Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android connection to CNAME fails #455

Closed
Floaty- opened this issue Apr 7, 2014 · 9 comments
Closed

Android connection to CNAME fails #455

Floaty- opened this issue Apr 7, 2014 · 9 comments

Comments

@Floaty-
Copy link

Floaty- commented Apr 7, 2014

First of all I must say what a GREAT idea with ownCloud. I love it.
Used a lot on my home computers.

But... ;)
I noticed something when setting up ownCloud on my android device.
In DNS theres a CNAME owncloud.mydomain.tld pointing to realhostname.mydomain.tld
When I try to connect to the CNAME owncloud.mydomain.tld it will not connect.
So I rooted my android device and added IP and owncloud.mydomain.tld to the hosts file.
Now my android device will connect.

Does the android client send realhostname.mydomain.tld instead of the name I type in as connection name?
Apache needs owncloud.mydomain.tld to serve the correct page. Not the name it gets translated from DNS.

Windows client does not have that problem. Am I doing something wrong or is this a bug?

{"installed":"true","version":"6.0.2.2","versionstring":"6.0.2","edition":""}
Android client is version 1.5.4

@davivel
Copy link
Contributor

davivel commented May 22, 2014

Hi. Sorry for answering so late, I didn't notice this message :$

The ownCloud app should access to whatever IP the DNS resolver determines. The app is not trying to resolve the domain names itslef, the network library takes care of it , taking into account the network configuration in the device.

Are you able to access your ownCloud server from the web browser in the device?

@Floaty-
Copy link
Author

Floaty- commented May 22, 2014

Thx for answering :)

It does try to connect however the web site is the wrong one.
On my Apache server there are multiple web sites identified by their domain name.
Only 1 ip address but multiple web sites.
I have a DNS A record for www.mydomain.tld and a CNAME for owncloud.mydomain.tld that points to www.mydomain.tld
My DNS checks for and denies, if I try to make multiple A records for the same ip address.

On the Android device I can connect just fine using any browser (tried firefox, chrome and Androids browser) and another app; ES File Explorer.
Only OwnCloud app failed to connect until I rooted the device and made an entry in the hosts file.

I have since found a work-around for my DNS settings so that I don't need to root any more devices.
I create a new sub domain, a new zone that i call owncloud.mydomain.tld.
In that new zone I create a DNS A record with the name * (wildcard) and use the ip address.
Now I don't have to use the CNAME any more, and I can connect just fine with OwnCloud app.

The work-around does not fix the problem with CNAME, it just enables me to not use CNAME.

This is great for taking pictures with instant upload to OwnCloud.

I know this is not high priority, but I hope you can use this information for something.

Kind regards
Floaty

@davivel
Copy link
Contributor

davivel commented May 22, 2014

Ok, I had to read a bit more about DNS, but now I understand. I must admit this overpassed my knowledge about DNS.

Probably this is a bug or limitation of our current network library. We should research deeper to be sure, but as you say we cannot take this as a high priority.

I am really happy you could find a workaround. Thanks for sharing with us. Let's keep it open, maybe we can take it into account when we decide to upgrade to a more recent network library.

@mooncong
Copy link

You can lookup dns manually.

private String getCnameForHost(final String host) throws TextParseException {
        final Lookup lookup = new Lookup(host, Type.CNAME);
        lookup.run();
        if (lookup.getAnswers().length == 0) {
            return null;
        }

        String target = ((CNAMERecord) lookup.getAnswers()[0]).getTarget()
                .toString();

        return target.substring(0, target.length() - 1);
    }

@jeweloper
Copy link

Any news to this bug?

I've got a internet access with a dynamic IP. This is the reason I have to use a DDNS-Service.
The only possibility to provide my self hosted owncloud service under my private domain is to use the DDNS-domain as CNAME.

So, the workaround mentioned by Floaty doesn't work, because I have not a static IP.

Are there any plans to fix this bug or any other known workarounds?

@davivel
Copy link
Contributor

davivel commented May 30, 2016

I'm sorry, but as far as I know, there is not a lot of interest in this.

Summoning @owncloud/android-developers for more opinions / hands.

@jeweloper
Copy link

@davivel thanks for your feedback.
After some "investigation" I recognized, that my problem is caused by a bug of my router.
If it is a CNAME-record-domain the IPv6 DNS lookup fails by the router.
The oc-desktop-client could handle it and fallback to IPv4 connection.
In android the connection is completely broken, when there is a problem with IPv6.
So I jump to conclusions.
My workaround is to disable IPv6 in android. I hope with a new router the problems are gone.

@LukeOwlclaw
Copy link

IPv6... yes, that issue is known: #616

@michaelstingl
Copy link
Contributor

In version 2.9, the ownCloud Android app switched to a new networking library. I'd assume this issue is gone. In case this happens again, please open a new issue. (too many things changed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants