광택: vcl_error 리디렉션

광택: vcl_error 리디렉션

Varnish 구성에 관해 몇 가지 질문이 있습니다. 다음과 같은 간단한 구성 파일이 있습니다.

backend default {
  .host = "127.0.0.1";
  .port = "80";
}

sub vcl_recv {

if (req.http.Host == "192.168.1.100")
  {
    set req.http.Location = "http://example.com" req.url;
    error 750 "Permanently moved - TEST";
  }
}

sub vcl_error {

if (obj.status == 750) {
  set obj.http.Location = req.http.Location;
  set obj.status = 301;
  return(deliver);
 }
}

질문:

(1) 나는 팔로우했다이것예: set req.http.Location = "http://example.com" + req.url;- 그러나 이 기호를 제거하지 않으면 광택제를 다시 로드할 수 없습니다. +- 필수 사항이며 그 목적은 무엇입니까?

# /etc/init.d/varnish reload
Loading vcl from /etc/varnish/default.vcl
Current running config name is reload_2013-12-17T15:01:43
Using new config name reload_2013-12-17T15:18:31
Message from VCC-compiler:
Expected variable, string or semicolon
(input Line 124 Pos 58)
    set req.http.Location = "http://example.com" + req.url;
---------------------------------------------------------#---------
Running VCC-compiler failed, exit 1VCL compilation failed
Command failed with error code 106
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 vcl.load failed

답변1

2.1에서 문자열 연결은 다음과 같습니다:

set req.http.Location = "http://example.com" req.url;

3.0에서는 이 작업이 명시적으로 "+"를 사용하여 수행되었습니다.

https://www.varnish-cache.org/docs/3.0/installation/upgrade.html#string-concatenation-operator

관련 정보