Skip to content

Host header #47

Closed
Closed

Description

@Israr

In HTTP GET request, if Host header contains port number (hostname:port), the server doesnt responds with data. For example HTTP request containing following host header will fail

Host: scontent.cdninstagram.com:443

Requests with following host header will succeed

Host: scontent.cdninstagram.com

Most http clients(I tested curl, chrome, and IE) will strip port number if it is default port for the protocol (80 for http ,or 443 for https). However, as per HTTP RFC host header may include port number if it is specified in URI.

14.23 Host
The Host request-header field specifies the Internet host and port number of the resource being requested, as obtained from the original URI given by the user or referring resource (generally an HTTP URL, as described in section 3.2.2).

Activity

  1. bugok commented on Jun 4, 2015

    @bugok
    Contributor

    @Israr - thanks for reporting.
    I'm not sure I understand your request. What is the issue with proxygen?

  2. Israr commented on Jun 4, 2015

    @Israr
    Author

    Let me explain with example. This is running proxygen and I can download the resource by executing following command

    curl --header "Host:scontent.cdninstagram.com"  https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11049316_1583549288528575_1352209504_n.jpg  -o imge.jpg
    

    In this case host header did not specify port (which is default behavior for curl and most browsers). However If host header explicitly specify port , it fails (The server times out). Following command will fail

    curl --header "Host:scontent.cdninstagram.com:443"  https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11049316_1583549288528575_1352209504_n.jpg  -o imge.jpg
    

    Apache and other http servers do not exhibit this problem. As per HTTP RFC, it is perfectly legal to specify port numbers in host header even if they are default port numbers. I used port 443 just an example, same issue appears with port 80.

    example behavior from other servers. (They all pass)

    1. Google servers (GSE/GWS/SFFE)
      curl --header "Host:www.google.com:443" https://www.google.com/images/srpr/logo11w.png -o imge.png
    2. IIS
      curl --header "Host:c.s-microsoft.com:443" https://c.s-microsoft.com/en-us/CMSImages/mslogo.png?version=856673f8-e6be-0476-6669-d5bf2300391d -o img.png
  3. bugok commented on Jun 4, 2015

    @bugok
    Contributor

    @Israr - what do you mean by "running proxygen"? What process are you running? The echo server?

  4. afrind commented on Jun 4, 2015

    @afrind
    Contributor

    This appears to be a config problem with instagram CDN, and our CDN team is investigating it. Although eliding the port number in the Host header on the client side would fix this, the correct fix is in our infra.

  5. Israr commented on Jun 4, 2015

    @Israr
    Author

    I haven't looked into proxygen code specifically for this problem. Since instagramcdn is running proxygen, and proxygen is facebook product, i thought this is the best place to report it.

  6. Israr commented on Sep 4, 2015

    @Israr
    Author

    This issue is still not fixed. Is it a proxygen issue or instagram CDN?

  7. w-o-o commented on Nov 4, 2016

    @w-o-o
    Contributor

    @Israr it works well for me now. Reopen this if you believe it is still an issue

    $ curl --header "Host:scontent.cdninstagram.com:443" https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11049316_1583549288528575_1352209504_n.jpg -o imge.jpg
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 6163 100 6163 0 0 8467 0 --:--:-- --:--:-- --:--:-- 8465

  8. Israr commented on Nov 5, 2016

    @Israr
    Author

    Yes, it works now. However I am very disappointed in the way the problem was addressed. Nobody root-caused the issue, and no-one responded to my comments, and then the issue self-healed itself after 1 year or so.

    Due to lack of response from maintainers, I had to implement workaround for this issue.

  9. afrind commented on Nov 7, 2016

    @afrind
    Contributor

    We did root cause the problem, sorry that is was not communicated well on this thread, and that it took so long to solve. Internal to Facebook, we had certain logic for processing requests that was conditional upon the host header that was expecting the default port to be elided. This was not really an issue with the proxygen library, but with the rule logic server side. This has been corrected.

    From: IK [email protected]
    Reply-To: facebook/proxygen [email protected]
    Date: Friday, November 4, 2016 at 5:39 PM
    To: facebook/proxygen [email protected]
    Cc: Alan Frindell [email protected], Comment [email protected]
    Subject: Re: [facebook/proxygen] Host header (#47)

    Yes, it works now. However I am very disappointed in the way the problem was addressed. Nobody root-caused the issue, and no-one responded to my comments, and then the issue self-healed itself after 1 year or so.

    Due to lack of response from maintainers, I had to implement workaround for this issue.

    —
    You are receiving this because you commented.
    Reply to this email directly, view it on GitHubhttps://github.com//issues/47#issuecomment-258579106, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AH4IaVk0sX4VCAKEAZ84Q3GDnE3V3N7hks5q69BTgaJpZM4EYbdV.

  10. afrind commented on Mar 1, 2017

    @afrind
    Contributor

    As mentioned before, this was an issue with the live site and not the library, and the live-site issue was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions