Skip to content

http to https redirection #169

@epik0r

Description

@epik0r

Hello,

is it possible to redirect from http to https like the following this?

sub vcl_recv {
    if (client.ip != "127.0.0.1" && req.http.host ~ "foobar.com") {
       set req.http.x-redir = "https://foobar.com" + req.url;
       return(synth(850, ""));
    }
}

sub vcl_synth {
    if (resp.status == 850) {
       set resp.http.Location = req.http.x-redir;
       set resp.status = 301;
       return (deliver);
    }
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions