|
19 | 19 | # Default server configuration
|
20 | 20 | #
|
21 | 21 |
|
| 22 | +proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m; |
| 23 | + |
| 24 | +upstream originserver { |
| 25 | + server 127.0.0.1:8081; |
| 26 | +} |
| 27 | + |
| 28 | +map $http_user_agent $browser_type { |
| 29 | + default "Edge"; |
| 30 | + "~Mozilla.*Firefox*" "Firefox"; |
| 31 | + "~Chrome*" "Chrome"; |
| 32 | +} |
| 33 | + |
22 | 34 | server {
|
23 | 35 | #set $browser 'c0n48jn5thv01k0ijmo0';
|
24 | 36 | listen 80 default_server;
|
@@ -48,28 +60,45 @@ server {
|
48 | 60 | server_name _;
|
49 | 61 | error_log /var/log/nginx/error.log debug;
|
50 | 62 |
|
51 |
| - fs_init 'blvo2kijq6pg023l8edg' 'wwURPfcEB01YVMfTYWfCtaezCkXVLeFZ61FJmXtI' '60' 'DEBUG' '0'; |
| 63 | + fs_init 'c0n48jn5thv01k0ijmo0' 'BsIK86oh7c12c9G7ce4Wm1yBlWeaMf3t1S0xyYzI' '500' 'ERROR' '0'; |
52 | 64 |
|
53 | 65 | location /test {
|
54 | 66 | fs_visitor_id $request_id;
|
55 |
| - fs_visitor_context user_agent:$http_user_agent; |
| 67 | + fs_visitor_context browser:$browser_type; |
56 | 68 | fs_get_all_flags;
|
57 | 69 |
|
| 70 | + include proxy_params; |
| 71 | + proxy_buffering on; |
| 72 | + proxy_cache my_cache; |
| 73 | + proxy_cache_valid any 10m; |
| 74 | + |
| 75 | + add_header X-Proxy-Cache $upstream_cache_status; |
58 | 76 | add_header x-flags $fs_flags;
|
| 77 | + add_header x-browser_type $browser_type; |
| 78 | + |
| 79 | + proxy_set_header X-Flagship-Flags $fs_flags; |
| 80 | + proxy_cache_key $fs_flags; |
| 81 | + |
59 | 82 | default_type text/html;
|
60 |
| - return 200 'gangnam style2!'; |
| 83 | + |
| 84 | + proxy_pass http://originserver; |
| 85 | + |
| 86 | + #return 200 $fs_flags; |
61 | 87 | }
|
62 | 88 |
|
63 |
| - location /loca { |
64 |
| - set $visitor "visitor_id"; |
65 |
| - |
66 |
| - fs_visitor_id $visitor; |
67 |
| - fs_visitor_context 'browser:Chrome'; |
68 |
| - # fs_get_all_flags; |
69 |
| - |
70 |
| - add_header x-flags "youpi"; |
| 89 | + location /experiment { |
| 90 | + |
| 91 | + include proxy_params; |
| 92 | + proxy_buffering on; |
| 93 | + proxy_cache my_cache; |
| 94 | + proxy_cache_valid any 10m; |
| 95 | + |
| 96 | + proxy_set_header X-Flagship-Flags "noflag"; |
| 97 | + |
71 | 98 | default_type text/html;
|
72 |
| - return 200 'gangnam style 2!'; |
| 99 | + |
| 100 | + proxy_pass http://originserver; |
| 101 | + |
73 | 102 | }
|
74 | 103 |
|
75 | 104 | # pass PHP scripts to FastCGI server
|
|
0 commit comments