terence4444
V2EX  ›  问与答

一个神奇的 HTTP 跳转:访问域名自动 302 到某个目录内,但点击回"/"却不会再跳转,这是如何实现的?

  •  
  •   terence4444 · Dec 9, 2016 · 3108 views
    This topic created in 3466 days ago, the information mentioned may be changed or developed.
    例子: https://www.humblebundle.com/
    现在进入站点后会自动 302 到 https://www.humblebundle.com/books/neil-gaiman-book-bundle
    现在如果:
    1. 点击 Game Bundles ,页面上显示的 a href = "/",会先重定向到 https://www.humblebundle.com/ 然后再跳转到 https://www.humblebundle.com/tycoon-simulator-bundle
    2. 再次在浏览器地址栏中输入 https://www.humblebundle.com/,还是被重定向到 https://www.humblebundle.com/books/neil-gaiman-book-bundle

    请问,这种访问同一个地址跳转到不同目录是如何实现的?
    5 replies    2016-12-09 23:29:31 +08:00
    lhbc
        1
    lhbc  
       Dec 9, 2016 via Android   ❤️ 1
    referrer
    sciooga
        2
    sciooga  
       Dec 9, 2016   ❤️ 1
    @lhbc 是 Referer 不是 Referrer ,相信你懂的。
    a67793581
        3
    a67793581  
       Dec 9, 2016
    终结~······
    terence4444
        4
    terence4444  
    OP
       Dec 9, 2016
    @lhbc
    @sciooga

    果然是,我在 HTTP 头里伪造了一个 'Referer',="https://www.humblebundle.com/" 就跳转到 1 的地方去了。
    非常感谢。
    lhbc
        5
    lhbc  
       Dec 9, 2016 via Android   ❤️ 1
    @sciooga 一开始拼错成 referer 了,现在两个好像都可以用的?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2852 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 05:53 · PVG 13:53 · LAX 22:53 · JFK 01:53
    ♥ Do have faith in what you're doing.