Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:37:50+00:00 2026-06-15T13:37:50+00:00

I have a site that has traffic spikes from only a few sources. This

  • 0

I have a site that has traffic spikes from only a few sources. This site also needs to be able to show content to a user by guessing if they’ve just arrived on the site using PHPs $_SERVER[“HTTP_REFERER”].

Is it possible to include the value of req.http.referer in the varnish cache so that this behavior is on more of an individual user basis? I believe that some users are being showed the wrong content because of another user caching content with a different referrer value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:37:52+00:00Added an answer on June 15, 2026 at 1:37 pm

    If you want the cache to be different on all referers possible the http protocols Vary-header is the solution for you. That will practically kill your cache hitrate if your traffic is not very uniform with referers from very few unique URLs.

    What I think is a better solution is to remove the logic of guessing who is a new user from the php layer and add it to varnish. This can be done by setting a custom header to the request in the vcl_recv and then using that header to hash in vcl_hash by adding something like this to vcl_recv

    if ((req.http.referer ~ "www.newuserhost1.com" || req.http.referer ~ "www.newuserhost2.com") &&
        req.url == "/") {
           req.http.X-New-User = 1;
    }
    

    And adding this to vcl_hash

     hash_data(req.http.X-New-User);
    

    When the user reaches your backend you can check the value of X-New-User from there instead of the referer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that has a lot of traffic coming from the alt
I have a site that has an Rss feed, and this feed is consumed
I have a Rails 2.1.2 site that only has html templates e.g. jobs.html.erb, so
I have a site that gets most of it's traffic (like 90%) from users
We have a large news-oriented site that has high web traffic. The architecture is
I have a site that has a /sites/default/files/ directory where user content is typically
I have a site that has 2 DIV tags, one floats left the other
Information: I have a site that has a design on index.php, and then you
I have a paging control on my site that has it's container element set
I have a two column site layout that has the content of the left

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.