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 7747457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:32:04+00:00 2026-06-01T10:32:04+00:00

I am using varnish 3.0 on ubuntu 11 – the redirect is being handled

  • 0

I am using varnish 3.0 on ubuntu 11 – the redirect is being handled by expressjs(v2.5.8 – running node.js 0.6) – the redirect is called by express (works without varnish in between) but when varnish is used in between, the redirect to a new page gets blocked (displays ‘Error 302 found’).

In the vcl config file for varnish, I have attempted to pass(return) based on URL and Referer (in the sub vcl_recv section) but I appear to have misconfigured (or need to add more config steps). Any thoughts/suggestions for changes in the vcl file would be quite welcome which would allow varnish to let expressjs redirect to new page.

Thanks in advance.

  • 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-01T10:32:05+00:00Added an answer on June 1, 2026 at 10:32 am

    Changing the sub_vcl_fetch fixed it.

    I have copied part of the sub_vcl_fetch section from my vcl file below:

    sub vcl_fetch {

    # Do not cache the object if the backend application does not want us to.
    if (beresp.http.Cache-Control ~ "(no-cache|no-store|private|must-revalidate)") {
    return(pass);
    }
    
    # Do not cache the object if the status is not in the 200s
    if (beresp.status >= 300) {
    # Remove the Set-Cookie header
    #remove beresp.http.Set-Cookie;
    return(pass);
    }
    
    #
    # Everything below here should be cached
    #
    # Remove the Set-Cookie header
    ####remove beresp.http.Set-Cookie;
    
    # Set the grace time
    set beresp.grace = 1s;
    
    # Static assets aren't served out of Varnish just yet, but when they are, this will
    # make sure the browser caches them for a long time.
    if (req.url ~ "\.(css|js|jpg|jpeg|gif|ico|png)\??\d*$") {
    /* Remove Expires from backend, it's not long enough */
    unset beresp.http.expires;
    
    /* Set the clients TTL on this object */
    set beresp.http.cache-control = "public, max-age=31536000";
    
    /* marker for vcl_deliver to reset Age: */
    set beresp.http.magicmarker = "1";} else {
    set beresp.http.Cache-Control = "private, max-age=0, must-revalidate";
    set beresp.http.Pragma = "no-cache";}
    
    ## If the request to the backend returns a code other than 200, restart the loop
    ## If the number of restarts reaches the value of the parameter max_restarts,
    ## the request will be error'ed.  max_restarts defaults to 4.  This prevents
    ## an eternal loop in the event that, e.g., the object does not exist at all.
    if (beresp.status != 200 && beresp.status != 403 && beresp.status != 404) {
    restart;
    }
    
    
    if (beresp.status == 302) {
    return(deliver);}
    # return(deliver); the object
    return(deliver);
    }
    

    Hope this helps!

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

Sidebar

Related Questions

Using C#, I need a class called User that has a username, password, active
I'm using varnish with -s malloc,1G" It's currently 98% full. Once it completely full
Hey everybody. I'm using Edge Side Includes on Varnish to cache a static HTML
We're currently running a site with: Pressflow 5.23.50 Varnish 2.1.4 I suspect some of
We are using Varnish at the front of Plone. In the case Plone goes
I'm running on XCode and using OpenGL ES 1.1 and I have two classes
Im trying to provide gzip compression using varnish cache. But when I set content-encoding
I have a HTML website running off Apache and using a MySQL database. I
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.

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.