How to get the current hostname in VCL?

Comments

3 comments

  • Austin Spires

    Hey @analogue, try req.backend.

    req.http.host pulls the inbound request Host header, so getting the domain for that is to be expected.

  • Cassandra Dixon

    If you are trying to get information about the origin, this help guide my be useful as well - Tracking you origin's name, ip, and port

  • analogue

    I don't think my question was clear enough =)

    If I serve domain.com with Fastly, I'd like to get "domain.com" somewhere. Not the hostname of a backend.

    I solved this by setting a new variable: set req.http.original_host = req.http.host

Please sign in to leave a comment.