Changeset 17 in bookmarks for trunk/BookmarkApp.pm


Ignore:
Timestamp:
03/28/13 17:17:24 (12 years ago)
Author:
peter
Message:
  • use the canonical form of the base URI in the feed id
  • use the X-Forwarded-Host header instead of just the server name, if present, to calculate the base URI, so that the public URI reflects any proxying that may be going on
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BookmarkApp.pm

    r16 r17  
    1313my $base_uri = URI->new; 
    1414$base_uri->scheme('http'); 
    15 $base_uri->host($ENV{SERVER_NAME}); 
     15$base_uri->host($ENV{HTTP_X_FORWARDED_HOST} || $ENV{SERVER_NAME}); 
    1616$base_uri->port($ENV{SERVER_PORT}); 
    1717$base_uri->path($ENV{SCRIPT_NAME} . '/'); 
     
    123123    my $feed = XML::Atom::Feed->new; 
    124124    $feed->title('Bookmarks' . ($tag ? " tagged as $tag" : '')); 
    125     $feed->id($base_uri . 'feed'); 
     125    $feed->id($base_uri->canonical . 'feed'); 
    126126 
    127127    # construct a feed from the most recent 12 bookmarks 
Note: See TracChangeset for help on using the changeset viewer.