Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

Download Pepper issue with mint on subdomain.

I recently moved from WordPress to Radiant CMS and deployed it using mod_rails. Long story short, everything works great except for the downloads pepper which is getting caught in an infinite loop. (Seems common with Rails, everything works until you try to do something different)

The problem started when I had to move my mint install from a subdirectory to a subdomain since mod_rails was trying to serve the /mint url with Rails. No amount of mod_rewrite rules would get around this problem. So i moved mint to “mint.pradador.com” and there were no issues until I realized that downloads were now broken. They would all display a “// You cannot download this file” error.

Looking at the docs, I found out about the &remote flag so it looks like this was expected behavior…Unfortunately, the javascript rewrite method doesn’t have an option to include the &remote flag. So I had to look at using mod_rewrite and here is where I’ve hit a wall. Even with the &force and &remote flags, the URLs simply go into an infinite loop. E.g:

  1. I try to download file pradador.com/assets/MooDocs.zip
  2. Mod_rewrite rewrites the url to mint.pradador.com/pepper/tillkruess/downloads/tracker.php?url=http%3A//pradador.com/assets/MooDocs.zip&force&remote
  3. The &force flag doesn’t work for some reason, so the system tries to access the pradador.com/assets/MooDocs.zip file again, and thus an infinite loop ensues.

I’ve banged my head against the wall a few times already so all that’s left is hoping for an answer here. Anyone got any tips?

Alright a quick waddle through the Download Pepper’s source code explained the problem. The &remote flag triggers an HTTP redirect to the path passed in the query. So I am indeed stuck in an infinite loop.

I’m tempted to write a patch to handle subdomains and when files reside on the same server. Maybe adding an option for the base root path from which to build file paths but that seems a bit daunting and maybe someone has a better solution?

Till
Third-Party Pepper Developer
Posted on Sep 25, '09 at 02:19 am

You’re not the only one : ) You can either write your own Download Pepper Module, or you use a RewriteRule like this:

RewriteCond /path/to/assets/$1
RewriteRule ^download/(.+)$ http://mint.pradador.com/pepper/tillkruess/downloads/tracker.php?url=http%3A//pradador.com/assets/$1&remote [L]

And don’t use the automatic JavaScript rewrite, its stupid.

You must be logged in to reply. Login above or create an account