How to get a root-url-based link that includes `http_prefix`

I have a header/footer that appears on all pages, and of course it has links to other pages on the site. This header/footer is on pages at various url “depths”-- e.g., it’s used in /, /docs/, and /docs/foo/.

If I wasn’t using http_prefix, then I could just use an absolute path for header/footer links and it would be good on all pages.

But… I need to use http_prefix. As far as I can tell, there’s no helper that will get me the root_url + http_prefix that I can use in my link_to() calls.

Is there a way I can get a result kind of like
link_to('linktext', root_url + http_prefix + rest_of_url) ?

I created this helper to deal with it. Feels like a hack.

helpers do
  def root_url(relative_to_root)
    if relative_to_root[0]=='/'
      relative_to_root = relative_to_root[1..-1]
    end
    "#{config.http_prefix}#{relative_to_root}"
  end
end

Now I can call this:

=link_to 'About', root_url('about.html')

This link will always give a link relative to root, including http_prefix, no matter what page this link appears on.

The more that I think about this, the more I think that link_to is simply deficient when it comes to http_prefix. It’s a bug! I think the actual fix is to make link_to prepend http_prefix to links that start with /.