How to get the current hostname in VCL?

Comments

4 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.

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • ravi prakash Bajpai

    analogue in which subroutine you are setting set req.http.original_host = req.http.host.

    0
    Comment actions Permalink

Please sign in to leave a comment.