HockeyKit icon indicating copy to clipboard operation
HockeyKit copied to clipboard

Failed to set the server

Open mobilehub opened this issue 15 years ago • 25 comments

hi,

I have started the apach service on my MacBookPro, and follow the wiki to set the server(just copy public and includes folder to my publicly accessible directory on my web server). And I create a app directory in the public directory, and copy .plist .ipa .mobileprovision to the app directory.

I Visit this page(public/index.php) directly from your your iPad, I can see my app on the web, and I tap the Install Application button, a pop up view show "Cannot connect to 10.0.0.5".

Where is problem my setting ?

Thanks very much.

mobilehub avatar May 12 '11 08:05 mobilehub

2.0b5 have the problem, and 1.0.2 have no such problem.

mobilehub avatar May 12 '11 08:05 mobilehub

Did you setup the .htaccess file as documented?

DerAndereAndi avatar May 12 '11 10:05 DerAndereAndi

I was having the exact same problem, and I switched from the "develop" branch to "master", and it was resolved.

jdjennin avatar May 27 '11 21:05 jdjennin

@jdjennin: did you setup the .htaccess file with the rewrite rules?

DerAndereAndi avatar May 27 '11 21:05 DerAndereAndi

I did. I was also tailing the Apache and PHP error logs, and there were none.

jdjennin avatar May 27 '11 21:05 jdjennin

Did you try to remove the ifmodule lines? We found in some apache installations it required that line, in others it didn't work with them.

DerAndereAndi avatar May 27 '11 21:05 DerAndereAndi

I did not. I am using the standard MAMP installation's Apache with the modifications from the HockeyKit documentation, if that helps at all. Excellent work, by the way, I wish I had known about this project sooner.

jdjennin avatar May 27 '11 21:05 jdjennin

Maybe these help: http://stackoverflow.com/questions/4600177/rewritelog-and-rewriteloglevel-in-mamp http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/

DerAndereAndi avatar May 27 '11 21:05 DerAndereAndi

I got the same issue, it opens the page on the device, but when pressing the Install Application button it shows a "Cannot connect" alert.

I tried removing the IfModule but it didn't help. I'm hosting it on a shared host (Dreamhost), and it was working with the old stable version, but on the develop branch it fails.

Maybe there's an issue with the generated URLs? Here are the URLs for the install button in both versions:

old itms-services://?action=download-manifest&url=http://www.mysite.com/apps/myproject/index.php?type=app&bundleidentifier=com.company.project

new itms-services://?action=download-manifest&url=http://www.mysite.com/apps/myproject/api/2/apps/com.company.project?format=plist

lkraider avatar Jun 27 '11 19:06 lkraider

Did you setup the redirect rules for your server?

DerAndereAndi avatar Jun 27 '11 19:06 DerAndereAndi

I am not really sure what would be the correct rules, but I tried it like this:

RewriteRule apps/myproject/.* /apps/myproject/index.php [L]

lkraider avatar Jun 27 '11 19:06 lkraider

I mean the rules defined in here:

https://github.com/TheRealKerni/HockeyKit/blob/develop/server/php/public/.htaccess

DerAndereAndi avatar Jun 27 '11 21:06 DerAndereAndi

Yeah, that's the one I changed with the RewriteRule I posted above. If I don't edit it the page will not even load, so I think it is working the way I wrote it.

lkraider avatar Jun 27 '11 21:06 lkraider

So I guess you also removed the RewriteCond line? The purpose of the rewrite condition is to rewrite only the requests to URLs that do not map to files directly. It all works until the device tries to fetch the actual IPA file. The URL in the plist to the IPA file should be correct but because your RewriteRule redirects all traffic to your index.php there is no way to get to the IPA file.

Even if the RewriteCond line is still there, it might not work, because your paths differ. In that case try adding a rewrite rule above the other rule like this:

RewriteRule .*ipa$ /apps/myproject/$1 [L,NC]

You can check on the command line with curl what the server actually outputs for a given URL. So use that to find out the URL of the IPA in the PLIST file (curl http://www.mysite.com/apps/myproject/api/2/apps/com.company.project?format=plist) and then use curl to get the actual IPA. curl -I will output the headers only, so you will not get all the binary garbage in your terminal.

Hope that helps a bit. Please report back with any updates. It would probably also help to know the Apache version for all rewrite related problems.

Soryu avatar Jul 02 '11 14:07 Soryu

What I don't understand is the /api/2 handling, this is the index.php that parses, right? Why doesn't it also serve the files instead of having to deal with htaccess at all? I don't want to customize htaccess for every project I have.

What I want is something like this:

{site}/apps/project1 {site}/apps/project2 {site}/apps/project3 ...

Where each project has a separate download page, so I copy the hockey/public folder contents to each of these and they should work. Actually, that works on the previous version but not on the new one, so I guess that's a regression of sorts.

lkraider avatar Jul 05 '11 17:07 lkraider

  1. You don't have to customize the .htaccess for every project. Do you it once for the installation of the server component
  2. The API does not only serve the files, but also the API requests, checking for new versions depending on bundle identifiers etc. The API was defined this way to make it easy for a full blown web service like HockeyApp to provide requests and responses RESTful.
  3. Why not have one installation and mark each app not being public. What you do instead is send out specific links to each apps download page. Check the wiki at https://github.com/TheRealKerni/HockeyKit/wiki/Server for the text at "Hiding application from main web page"
  4. It is a regression of sort, but works as designed, as the previous way to handle it wasn't intended but worked.

The problem here is, that it seems RewriteRules are not working the same way everywhere even though they should. The rewrite rules is defined to be setup in the root of the HockeyKit public directory. It is defined absolutely generic, so you should not need to have the need for adjusting it. All you need to do is making sure RewriteRules are working and can be defined on the server. You might also want to check out this issue for a hint: https://github.com/TheRealKerni/HockeyKit/issues/43

DerAndereAndi avatar Jul 06 '11 11:07 DerAndereAndi

Thanks for your support, but I can't seem to set it up the way I need it... I'll try understanding the code first to know what's going on and try to figure out how to make it work in my specific setup. Ideally, I would prefer to have all hockey public files on one folder, and subfolders for each project and the app folders inside those (each project actually has many apps, they are like groups of apps in my case).

lkraider avatar Jul 06 '11 14:07 lkraider

You might want to take a look at this fork then: https://github.com/pyby/Hockey This one is based on HockeyKit 1.x, and provides multiple "stores".

DerAndereAndi avatar Jul 06 '11 15:07 DerAndereAndi

I got the same error and I resovled it;

My mistakes are following:

  1. I don't use FollowSymLinks in apache conf, so apache's error_log report the rewrite rule will be forbidden.
  2. I use a Alias for the url, then the .htaccess should have a RewriteBase directive

sprhawk avatar Oct 29 '11 09:10 sprhawk

This might be the issue: https://github.com/TheRealKerni/HockeyKit/issues/113#issuecomment-5214761

radekskowron avatar Apr 19 '12 04:04 radekskowron