Skip to content

Instantly share code, notes, and snippets.

@TimothyRHuertas
Last active September 11, 2015 17:02
Show Gist options
  • Save TimothyRHuertas/228857d5d1d78d49e17e to your computer and use it in GitHub Desktop.
Save TimothyRHuertas/228857d5d1d78d49e17e to your computer and use it in GitHub Desktop.
Rails + webbrick + redirect_to + itms-services == bug

Problem:

Calling redirect_to "itms-services:\/\/\/\/?action=download-manifest&url=#{some_url}" does not behave as expected. It sets the location header to itms-services:?action=download-manifest&url=#{some_url} it should be itms-services://?action=download-manifest&url=#{some_url} Notice the forward slashes are missing from the location header value.

Solution (a dirty, dirty hack); use four backslashes:

redirect_to "itms-services:\/\/\/\/?action=download-manifest&url=#{some_url}"
@TimothyRHuertas
Copy link
Author

I ended up doing redirect_to "itms-services:\/\/myAppName?action=download-manifest&url=#{some_url}" instead. I think web brick gets pissed because it does not see a hostname between the protocol and query string. Adding one made it happy.

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