The Referer header identifies the URL from which the current request originated, letting servers track traffic sources, apply access rules, or tailor responses based on referral context.
By default, cURL does not send a referer. Specifying one simulates arriving from another page, aiding in debugging scenarios where server responses depend on perceived inbound links.
Adjusting the Referer helps test analytics, verify access policies, or confirm that the server reacts correctly to requests with specific referral backgrounds.
Steps to set a custom referrer in cURL:
- Open a terminal.
- Set the referrer using --referer.
$ curl --referer "http://example-referrer.com" "http://example.com"
This adds the Referer header to the request.
- Verify the custom referer in verbose output.
$ curl --referer "http://example-referrer.com" "http://example.com" --verbose > Referer: http://example-referrer.com
--verbose confirms the referer header inclusion.
- Send no referer by specifying an empty string.
$ curl --referer "" "http://example.com"
An empty referer simulates direct access without a preceding page.
- Check server logs or responses to confirm that referrer checks work as expected.
Servers may alter responses based on the Referer header.

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.