Running with local DNS server and IIS

Hello.

 

Im trying to get this to run on my local IIS server and DNS server.


trailers.apple.com is forwarded to my local server (10.0.0.2) and works.

 

I setup a site for trailers.apple.com to the assets folder. 

 

The app is still reporting an error on the apple tv.

 

I suspect this is because python detects the apple tv and puts it in some settings somehere?

 

Anyone tried this setup?

 

would love to get it to run. it seems to be .js and xml, so i might be lucky? :)

Yes, I've tried this under Linux with my own DNS-server and an Apache-reverse proxy. However Apache reports HTTP 502-errors. There are some invallid HTTP-request fired to Apache that apache can't forward.

I've tried a vhost with a ProxyPass / to the PlexConnect-app (including ProxyPreserveHost on), because I have some other apps behind my Apache-server, such as CouchPotato and such. No luck for me with this setup due to the invalid request though.

Another problem is the 403-methods. Someone thought that it makes sense to create some access list that only the IP-adress of the AppleTV is allow to do request to this app. I don't think thats sensible, so I hacked that access list out of the config and it worked (a bit more). But still no luck for me.

From what i can see the python files go alot deeper than just serveing up the files. For this to work it would have to be rewritten from ground up. :(

I don't think it is as simple as just serving the assets-folder. I think you should create a reverse proxy with IIS and run PlexConnect on a different port than 80. That's your only chance i think, because there is some XML-templating done in this application.

Thats a good idea! thanks. I will try and see if i can get it working.

Trying the reverse proxy now. Im getting this error though:

PlexConnect : ***
PlexConnect : PlexConnect
PlexConnect : Press ENTER to shut down.
PlexConnect : ***
PlexConnect : IP_self: 10.0.0.2
PlexGDM : ***
PlexGDM : looking up Plex Media Server
PlexGDM : ***
PlexGDM : servers discovered: 1
WebServer : ***
WebServer : WebServer: Serving HTTP on 0.0.0.0 port 9999.
WebServer : ***
10.0.0.2 - - [06/Jun/2013 12:25:07] code 403, message Not Serving Client 10.0.0.
2
10.0.0.2 - - [06/Jun/2013 12:25:07] "GET /appletv/us/js/application.js HTTP/1.1"
 403 -
 
 
It seems im getting stuck here in webserver.py: 
 
if self.headers['Host'] == Settings.getHostToIntercept() and \
               self.headers['User-Agent'].startswith("iTunes-AppleTV"):
 
Can i rewrite my user-agent with URL rewrite?

well got it to accept the reqiests by setting it to 1==1 - the problem now is it wont play the movies (if i choose a movie it just says the trailer is not available..... :-/

Fixed it!

for those who wanna try this themselfs this is my web.config file

<?xml version="1.0" encoding="UTF-8"?>
 
   
   
 
 
   
     
       
         
           
         
       
     
     
       
         
          http://10.0.0.2:9999/{R:1}" />
       
     
   
 

i forgot - in the WebServer.py you need to change the port, AND remove the IF statements before the code executes (see previous post)

Nice work, i have linked to this thread from the wiki.

If you want to do a full step by step picture guide i will happily put it up. 

@Wraithbone 

Do you have any problems with the proxy-requests? Under Apache, the apache-server is not always posting the correct request to the PlexConnect-app, because of malicious http-request (in the eyes of Apache). And what version of PlexConnect are you running? Maybe my PlexConnect-version that I tried is not that recent.

Yes i have had this problem. I fixed it with the system.web tag above.

I have no idea if there is an apache equalent.

I will think about making a guide.

I will search for the apache-equivalent when I'm at home. Thanks!

No problem. Please post your solution if you find it. It might be of help to someone else. :slight_smile:

OK, so PlexConnect is HTTP/1.0 at the moment. Apache reverse proxy has to be forced into HTTP/1.0-mode for the proxypass-section.

My Proxy-settings is the following:


    ServerName trailers.apple.com
    ErrorLog ${APACHE_LOG_DIR}/trailers_error.log
    CustomLog ${APACHE_LOG_DIR}/trailers_access.log combined
    ## Proxy-stuff
    ProxyRequests On
    ProxyPreserveHost On
 
    
		Order Deny,Allow
        Deny from all
        ## Allow from AppleTV IP-address
        Allow from 10.0.0.94
    
    
        ProxyPass http://localhost:8085/
        ProxyPassReverse http://localhost:8085/
        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1
    

The problem however at the moment is that iOS 5.0.2 is kinda botchy. The settings-screen is terribly slow and those settings are getting through twice. The first is a HTTP 200 and the second request returns a HTTP 502 with apache. This behavior is with 5.0.2 and i'm looking for this stuff in the latest version at the moment. Hope that solves all the problems and the double request.

I figured it out why Apache is returning the HTTP 502-error. 

It is happening in the atvlogger-handler. The difference with that is that it doesn't send a response back to the client, so the webserver or client is retrying multiple times. I've added a HTTP 200 response to it and the errors are gone and the atvlogger-line is only showed once!

I've added the following lines:

                    dprint('ATVLogger', 0, msg)
                    self.send_response(200)
                    self.send_header('Content-type', 'text/plain')
                    self.end_headers()
                    self.wfile.write("Entered GET request handler")
                    time.sleep(1)
                    self.wfile.write("Sending response!")
                    return

Did a bounce and it worked!!

Hey rippiedoos, thanks for the tip, I will makes these changes. Just a quick question is it necessary to write 2 strings with a 1 second pause between? Wouldn’t just writing 1 string be enough? In fact do we need to send anything, would just sending the 200 response and the header be enough?

Hi Wraithbone,

could you plz creat  guide? :)

Have a frontend development test coming up on Monday, so I’m hitting the books at the moment. When I get an A I will get back to you. :wink:

Could you at least tell me where i have to edit the Ports and wich IF string i need to remove?

THX :)