Requests with absolute uri return 404

Comments

3 comments

  • Rogier Mulhuijzen

    Hi Eric,

    First off, can you elaborate on the circumstances where this would happen? Because we've not seen any browsers or other clients behave this way (they all tend to CONNECT.) So it would be good for us to know the details around cases where it does happen.

    Second, a change has been made to include support for absolute URLs that start with https instead of http. It should be rolled out in the next week or so.

    Third, if this is a problem that you're running into that needs urgent fixing, you can use either this snippet of VCL:

    if (req.url ~ "(?i)^https://") { set req.url = regsub(req.url, "(?i)^https://[^/]*",""); }

    Or you can add a Header object in the UI, under Configure > Content, and use the following settings:

    Name: something descriptive like "strip absolute URLs" Type: Request Action: Regex Destination: url Source: req.url Regex: (?i)^https://[^/]* Substitution: empty

    After adding it, you can then add a Condition to it that reads: req.url ~ "(?i)^https://"

    I hope this helps, and I'm very curious as to the answer to my question.

    Cheers,

    Doc

  • Eric Meadows-Jönsson

    Hi,

    The header configuration you suggested works great and resolves our issue, thank you. It seems an absolute URI starting with http:// always works, even without any special rules in my configuration, why is that?

    Second, a change has been made to include support for absolute URLs that start with https instead of http. It should be rolled out in the next week or so.

    That is good news, when the change is rolled out can I remove the header configuration then?

    First off, can you elaborate on the circumstances where this would happen? Because we've not seen any browsers or other clients behave this way (they all tend to CONNECT.) So it would be good for us to know the details around cases where it does happen.

    The client we are using, httpc from Erlang/OTP, uses CONNECT when proxying https connections but even when using CONNECT it uses an absolute URI in the subsequent request. I haven't found anything in the HTTP RFCs that indicates that this is wrong but from googling around it seems to be uncommon behaviour. I am discussing with the OTP team if it can be changed to using a path URI in the request after the CONNECT. (For reference: https://github.com/erlang/otp/pull/1052)

  • Rogier Mulhuijzen

    [quote="ericmj, post:3, topic:695"] The header configuration you suggested works great and resolves our issue, thank you. It seems an absolute URI starting with http:// always works, even without any special rules in my configuration, why is that? [/quote]

    We have code for removing the http://<hostname> from URLs in our master VCL, and since this is the first time we ran into a client that didn't use CONNECT properly, we never saw any reason to strip https://<hostname>.

    [quote="ericmj, post:3, topic:695"] That is good news, when the change is rolled out can I remove the header configuration then? [/quote]

    Yes, once we've rolled out our change, you'll be able to remove the workaround.

    [quote="ericmj, post:3, topic:695"] The client we are using, httpc from Erlang/OTP, uses CONNECT when proxying https connections but even when using CONNECT it uses an absolute URI in the subsequent request. I haven't found anything in the HTTP RFCs that indicates that this is wrong but from googling around it seems to be uncommon behaviour. I am discussing with the OTP team if it can be changed to using a path URI in the request after the CONNECT. (For reference: https://github.com/erlang/otp/pull/1052) [/quote]

    Good to know! Thank you!

Please sign in to leave a comment.