Minting clean URLs to be hosted at a 3rd party

On a vaguely similar topic as the .htaccess discussion, I ran into
a problem using a third party service to host some triples. I want
my URLs to be "pretty", and based on a domain that I control.
Something like:

  http://nrhpdata.daytripr.com/site/72001552

(which describes a United States National Register of Historic
Places site.) But when hosting at Talis[1] (or anywhere but
nrhpdata.daytripr.com) I end up with something like:

  http://api.talis.com/stores/ckstjohn-dev1/meta?about=http://nrhpdata.daytripr.com/site/72001552

Having to think about hosting when coming up with a URL scheme
is distracting, but necessary if you ever plan on dereferencing your
URIs.

Using purl (more or less[2]) forces you to use the purl.org domain,
which wasn't acceptable (I hesitate to mint URLs under domains
I don't have administrative control over)

So I wrote a quick redirector service that uses the HTTP host
header to index into a regex/template pair map:

  hostname: nrhpdata.daytripr.com
  pattern: http://nrhpdata.daytripr.com/site/([^/]*)
  template: http://api.talis.com/stores/ckstjohn-dev1/meta?about=http://nrhpdata.daytripr.com/site/{1}

And then 303's the resulting URL.

For that to work, I had to CNAME nrhpdata.daytripr.com over to
the redirector service host, but by following the mint-in-a-domain-
you-control rule I'm able to do that without much trouble (and switch
it someplace else when I eventually move the data)

I've found it useful, since it lets me come up with a clean URL
scheme and get something up and running faster than I could
if I had to worry about hosting all the data immediately.

I wrote it to be generic[3] and will definitely use it to get some
other projects off the ground quickly, but I was curious if anyone
else would find it useful.

-cks


[1] I'll eventually apply for a Talis Connected Commons account
to host the data, it's all government stuff, but for experimentation
the dev account is convenient.

[2] If you apply for a top-level namespace you can kinda sorta get
the same effect by CNAME-ing over, but that assumes you can get
permission, and the rest of the URL has to match exactly.

[3] http://uridirector.praxisbridge.org/redir/register, feel free to play
around, but the service is unstable at the moment and I'm probably
going to be flushing the database a few more times before it's ready
for real use.

--
Christopher St. John
http://praxisbridge.com

Received on Tuesday, 7 July 2009 20:15:34 UTC