summaryrefslogtreecommitdiff
path: root/caddytest/integration/caddyfile_adapt/forward_auth_rename_headers.txt
blob: 65228174d73476bd8f403ac042f802787cb531e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
:8881

forward_auth localhost:9000 {
	uri /auth
	copy_headers A>1 B C>3 {
		D
		E>5
	}
}
----------
{
	"apps": {
		"http": {
			"servers": {
				"srv0": {
					"listen": [
						":8881"
					],
					"routes": [
						{
							"handle": [
								{
									"handle_response": [
										{
											"match": {
												"status_code": [
													2
												]
											},
											"routes": [
												{
													"handle": [
														{
															"handler": "headers",
															"request": {
																"set": {
																	"1": [
																		"{http.reverse_proxy.header.A}"
																	],
																	"3": [
																		"{http.reverse_proxy.header.C}"
																	],
																	"5": [
																		"{http.reverse_proxy.header.E}"
																	],
																	"B": [
																		"{http.reverse_proxy.header.B}"
																	],
																	"D": [
																		"{http.reverse_proxy.header.D}"
																	]
																}
															}
														}
													]
												}
											]
										}
									],
									"handler": "reverse_proxy",
									"headers": {
										"request": {
											"set": {
												"X-Forwarded-Method": [
													"{http.request.method}"
												],
												"X-Forwarded-Uri": [
													"{http.request.uri}"
												]
											}
										}
									},
									"rewrite": {
										"method": "GET",
										"uri": "/auth"
									},
									"upstreams": [
										{
											"dial": "localhost:9000"
										}
									]
								}
							]
						}
					]
				}
			}
		}
	}
}