Podcast Producer Community Site

Welcome to podcastproducer.org
Friday, September 03 2010 @ 01:09 PM CEST

Running Podcast Library on a different port (first attempt)

Podcast Producer uses ports 8170 and 8171 for communication between Podcast Capture/pcast and the server. Podcast Library also serves its feeds and assets over these ports. Port 8170 is for SSL encrypted connections and port 8171 for unencrypted connections. In some situations it is not an option to use these ports. IT might not want to open these ports on the firewall, or your students who want to access the feeds or assets might be on a network that only allows connections over ports 80 and 443. To avoid these problems I have been looking for ways of using the Podcast Library over the standard ports. I will describe two possible solutions to approach this problem.

There is a simple way and an elaborate way. In this case I would not recommend the simple way. This involves just changing the port that the Podcast Producer service is started on. You can do this with the serveradmin tool in the Terminal:


sudo serveradmin pcast:server_port = 79
Setting the port to 79 will make sure that the default SSL port is 79 and that the default non-ssl port is 80. Here you can also see what the problem is with this solution: all your connections from pcast or Podcast Capture will have to specify the port. The URLs you will need to use in Podcast Capture will look like this: server.example.com:79. Also, you are kind of hijacking port 80 with this solution, so using the Wiki or other web services on the same machine will be problematic.

The second solution involves running a reverse proxy on your webserver. This way Podcast Producer runs happily on ports 8170 and 8171, but you can receive requests on ports 80 and 443. You can very easily set this up in Server Admin:

• Open Server Admin > Web and add a website with the desired hostname
• Go to the 'Proxy'-tab and enable the reverse proxy
• Click on the '+' symbol to add a Worker URL and give 'http://127.0.0.1:8171' for 'Server URL', leave 'Route' empty

Save the settings and restart the Web service. This should now work for all your direct links like http://server.example.com/podcastproducer/path/to/my/asset, but the feeds still wont work correctly. All the links in your Podcast Library feeds will still have the port 8171 (for non-SSL) in it. I have been looking at ways of rewriting this with mod_proxy_html, but that only works for HTML content. So this would work for all the links to your assets in the Wiki pages, but not in the atom and rss feeds. I have been trying to get mod_proxy_html to work, but haven't been successful so far. If anybody has more experience with this and would like to help me out, please let me know.

For now I have used a different way to get this to work. This involved changing some of the Podcast Producer code, so be aware on your production systems. I would recommend to test this thoroughly before even thinking about doing this on a production system. Better still: Don't do this on a production system at all. These changes are definitely not supported, so if system updates come in they might break your hacks (or your server altogether). Backup all the files before you start changing them.

There are a couple of places in the feeds where you would need the URL to be changed. I did the following:

In /usr/share/podcastproducer/pcastserverd/app/views/feeds/atom_feed.xml.builder change the following lines. (where is the hostname of your server, like 'server.example.com')


line 27:
xml.logo logo_url
to
xml.logo logo_url.gsub("127.0.0.1:8171", "<hostname>")

line 30:
xml.icon icon_url
to
xml.icon icon_url.gsub("127.0.0.1:8171", "<hostname>")

line 39:
xml.tag!("link", :rel => "self", :type => "application/atom+xml", :title => @feed.localized_name, "pcp:feedtype" => @feed.feed_type, :href => admin_atom_feed_url(:uuid => @feed.uuid))
to
xml.tag!("link", :rel => "self", :type => "application/atom+xml", :title => @feed.localized_name, "pcp:feedtype" => @feed.feed_type, :href => admin_atom_feed_url(:uuid => @feed.uuid)).gsub("127.0.0.1:8171", "<hostname>"))

line 41:
xml.tag!("link", :rel => "self", :type => "application/atom+xml", :title => @feed.localized_name, "pcp:feedtype" => @feed.feed_type, :href => atom_feed_url(:uuid => @feed.uuid))
to
xml.tag!("link", :rel => "self", :type => "application/atom+xml", :title => @feed.localized_name, "pcp:feedtype" => @feed.feed_type, :href => atom_feed_url(:uuid => @feed.uuid)).gsub("127.0.0.1:8171", "<hostname>"))

line 44:
xml.tag!("link", :rel => "alternate", :type => "text/html", :title => "Podcast Producer", :href => overview_url)
to
xml.tag!("link", :rel => "alternate", :type => "text/html", :title => "Podcast Producer", :href => overview_url).gsub("127.0.0.1:8171", "<hostname>"))

line 53:
xml.tag!("link", :rel => "root", :type => "application/atom+xml", :title => @root_catalog.localized_title, "pcp:feedtype" => @root_catalog.name, :href => admin_catalog_root_url)
to
xml.tag!("link", :rel => "root", :type => "application/atom+xml", :title => @root_catalog.localized_title, "pcp:feedtype" => @root_catalog.name, :href => admin_catalog_root_url).gsub("127.0.0.1:8171", "<hostname>"))

line 55:
xml.tag!("link", :rel => "root", :type => "application/atom+xml", :title => @root_catalog.localized_title, "pcp:feedtype" => @root_catalog.name, :href => catalog_root_url)
to
xml.tag!("link", :rel => "root", :type => "application/atom+xml", :title => @root_catalog.localized_title, "pcp:feedtype" => @root_catalog.name, :href => catalog_root_url).gsub("127.0.0.1:8171", "<hostname>"))

line 150:
attachment_hash[:href] = attachment_url 
to
attachment_hash[:href] = attachment_url.gsub("127.0.0.1:8171", "<hostname>")
For the RSS-feed change the following lines in /usr/share/podcastproducer/pcastserverd/app/views/feeds/rss_feed.xml.builder

line 33:
logo_url = feed_logo_url(:uuid => @feed.uuid, :extension => @feed.logo_extension)
to
logo_url = feed_logo_url(:uuid => @feed.uuid, :extension => @feed.logo_extension).gsub("127.0.0.1:8171", "<hostname>")

line 37:
xml.tag!("link", overview_url)
to
xml.tag!("link", overview_url.ggsub("127.0.0.1:8171", "<hostname>")

line 104:
attachment_url = attachment_url(:feeduuid => @feed.uuid, :uuid => attachment.uuid, :extension => attachment.extname)
to
attachment_url = attachment_url(:feeduuid => @feed.uuid, :uuid => attachment.uuid, :extension => attachment.extname).gsub("127.0.0.1:8171", "<hostname>")

Hey, I didn't say it was going to be pretty, but it seems to work. And I have to say again: this is all highly unsupported. This seems to work to get your feeds to point to the correct URLs for the attachments, but if you want your assets in your Wiki and Blog pages to have the right URLs it is better to look at mod_proxy_html. If I get the feeds to be re-written through some other form of proxy I will post this, so we can get rid of all these ugly code changes. For now I hope I got the ball rolling a bit on running Podcast Library feeds over a different port and all suggestions are welcome.

Story Options

Running Podcast Library on a different port (first attempt) | 5 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Running Podcast Library on a different port (first attempt)
Authored by: Ricardo DeMatos on Friday, March 05 2010 @ 06:14 PM CET
I have been able to place an apache web server acting as a reverse proxy to the podcast library without making any changes to podcast producer.

here is the apache directives that I used:

# podcast producer config
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /podcastproducer http://internal.company.com:8171/podcastproducer
ProxyPassReverse /podcastproducer http://internal.company.com:8171/podcastproducer
ProxyPassReverseCookieDomain internal.company.com internal.company.com
ProxyPassReverseCookiePath /podcastproducer /podcastproducer

where internal.company.com is the hostname of the Mac OSX server.

Again, i can reach the Podcast Library, feed AND its content entirely via HTTPS via the reverse proxy

This is great news ... and Apple must have fixed something.

Ricardo.
Running Podcast Library on a different port (first attempt)
Authored by: gduncan on Friday, March 19 2010 @ 01:34 PM CET

I am interested in running PcP behind a firewall that only allows port 80 and 443 traffic. It would be very helpful if you could reproduce the exact steps you undertook to achieve this. I have Setup a reverse proxy in the manner described and added Apache directives as suggested but with no luck.

Hope users in this community can help

Thanks GD

Running Podcast Library on a different port (first attempt)
Authored by: Ricardo DeMatos on Friday, March 05 2010 @ 06:22 PM CET

Also, serveradmin command should include the "settings" arg

sudo serveradmin settings pcast:server_port = 79

Ricardo.

Running Podcast Library on a different port (first attempt)
Authored by: Marcel Borsten on Friday, March 05 2010 @ 06:52 PM CET

Thanks for the comment Ricardo! As soon I have some time I'll test this and update the article (or make a new one).

Running Podcast Library on a different port (first attempt)
Authored by: cape_pod on Sunday, May 09 2010 @ 08:23 PM CEST

Hi Ricardo,
The reverse Proxy solution is a great idea to solve this problem and having PcP being accessible on port 80/443. One catch I found though is that once you connect to the podcast library on port 80 and you navigate through the library feeds, the web browser will automatically add the ":8171" ports back to the URLs. This is understandable as the feeds still have the "8171" port in their URL. It is possible to just take them away in the browser URL (and you will still have access to the feeds on port 80) but it isn't exactly 100% user friendly to ask users to take away the "8171" portion of the URL in their browser windows. Do you know of a way to automatically redirect all traffic to port 80?
Any suggestions are greatly appreciated.
Thanks, Oliver