0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VarnishでのHTTP→HTTPSへの固定(HTTPS Only)

Last updated at Posted at 2021-11-26

###本項はLumen Edge Application DeliveryでのVarnishについての記述です
https://lumen-28.hubspotpagebuilder.com/lumen-technologies-japan/lumen-edge-cloud-app-delivery

#HTTP→HTTPSへの固定(HTTPS Only)

この場合は以下のリライトを設定します

VCLv4
sub vcl_recv {
  if (req.http.X-Forwarded-Proto !~ "https") {
    return (synth(850, "Moved Permanently"));
  }
}

sub vcl_synth {
  if(resp.status == 850) {
    set resp.http.Location = "https://" + req.http.host + req.url;
    set resp.status = 301;
    return(deliver);
  }
}

sub vcl_hash {
  hash_data(req.http.X-Forwarded-Proto);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?