[Mailman] 301 redirect looping varnish and nginx

Rodrigo Ghion rodrigo.q.ghion at gmail.com
Tue Sep 18 18:28:35 UTC 2018


Good afternoon,

I am having 301 redirect looping problem using nginx and varnish.

I use nginx for input on port 443 to use https and varnish on port 80.
Varnish can cache https.

But I'm having 301 redirect looping problem because my application
uses redirect.

Here is my nginx and varnish:


# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at
https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "172.16.12.9";
    .port = "80";
}

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    #
    # Typically you clean up the request here, removing cookies you don't
need,
    # rewriting the request, etc.
}

sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    #
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.
}

sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
}



server {
        listen 443 ssl;

        server_name www.magazinebrunilda.com.br magazinebrunilda.com.br;
        ssl_certificate
/etc/nginx/ssl/magazinebrunilda/magazinebrunilda.crt;
        ssl_certificate_key
/etc/nginx/ssl/magazinebrunilda/magazinebrunilda.key;


access_log      /var/log/nginx/magazine-access.log;
error_log       /var/log/nginx/magazine-error.log;
access_log on;

        location / {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Port 443;
            proxy_set_header Host $host;
            proxy_pass http://127.0.0.1:80;

        }
}


--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.varnish-cache.org/lists/pipermail/mailman/attachments/20180918/e59c4917/attachment.html>


More information about the Mailman mailing list