Issues

Issue #3856 closed

username.bitbucket.org lacks proper redirect for subdirectories (BB-3910)

Wolfgang Scherer
created an issue

I checked the server response for my subdirectory http://wolfmanx.bitbucket.org/ws-vacation and saw that links without a trailing slash do not get a 301 redirect from nginx.

http://wolfmanx.bitbucket.org/ws-vacation should get a 301 redirect to http://wolfmanx.bitbucket.org/ws-vacation/, so that the browser knows how to construct relative links correctly.

But I can live with my workaround (see anonymous post at http://confluence.atlassian.com/display/BITBUCKET/Publishing+a+Website+on+bitbucket)

Comments (8)

  1. Wolfgang Scherer reporter

    Here is a nice short workaround, that can be used in a script element on the index.html page:

    From: David Chambers [Atlassian]

    if (!/(\.html|\/)$/.test(location.pathname)) location.pathname += '/'
    
  2. Wolfgang Scherer reporter

    On second thought, it probably should be fixed on the server side, in order for automatic crawling and the browser "Back" button to work correctly.

    This is what I get from my apache2 server, when I access a directory link that is automatically served with an index.html:

    (unset LANG LANGUAGE; wget -O - --save-headers http://simul.de/vb)
    --2012-04-03 11:21:15--  http://simul.de/vb
    Resolving simul.de... 192.168.33.252
    Connecting to simul.de|192.168.33.252|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: http://simul.de/vb/ [following]
    
  3. mackyle

    Has this been fixed?

    Fetching the example http://wolfmanx.bitbucket.org/ws-vacation seems to be producing the desired 301 redirect now:

    * About to connect() to wolfmanx.bitbucket.org port 80 (#0)
    *   Trying 207.223.240.181... connected
    > GET /ws-vacation HTTP/1.1
    > Host: wolfmanx.bitbucket.org
    > Accept: */*
    > User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
    > 
    < HTTP/1.1 301 MOVED PERMANENTLY
    < Server: nginx/1.0.6
    < Date: Mon, 17 Dec 2012 17:59:57 GMT
    < Content-Type: text/html; charset=utf-8
    < X-Request-Count: 36
    < Content-Length: 0
    < X-Served-By: bitbucket02
    < Vary: Cookie
    < X-Version: 309704b5e60d
    < ETag: "d41d8cd98f00b204e9800998ecf8427e"
    < Location: http://wolfmanx.bitbucket.org/ws-vacation/
    < X-Static-Version: 309704b5e60d
    < Strict-Transport-Security: max-age=2592000
    < 
    * Connection #0 to host wolfmanx.bitbucket.org left intact
    * Closing connection #0
    
  4. Log in to comment