How to get the current hostname in VCL?


If I use in the src parameter of a header, I get the hostname of the backend.
How can I get the request hostname instead?

I’d like to not have to hardcode my domain.



Hey @analogue, try req.backend. pulls the inbound request Host header, so getting the domain for that is to be expected.


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


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

If I serve with Fastly, I’d like to get “” somewhere.
Not the hostname of a backend.

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