mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 18:47:20 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			121 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
| 	http_port 3010
 | |
| }
 | |
| localhost:3010 {
 | |
| 	root * /srv
 | |
| 	error /private* "Unauthorized" 410
 | |
| 	error /hidden* "Not found" 404
 | |
| 
 | |
| 	handle_errors 404 410 {
 | |
| 		respond "404 or 410 error"
 | |
| 	}
 | |
| }
 | |
| ----------
 | |
| {
 | |
| 	"apps": {
 | |
| 		"http": {
 | |
| 			"http_port": 3010,
 | |
| 			"servers": {
 | |
| 				"srv0": {
 | |
| 					"listen": [
 | |
| 						":3010"
 | |
| 					],
 | |
| 					"routes": [
 | |
| 						{
 | |
| 							"match": [
 | |
| 								{
 | |
| 									"host": [
 | |
| 										"localhost"
 | |
| 									]
 | |
| 								}
 | |
| 							],
 | |
| 							"handle": [
 | |
| 								{
 | |
| 									"handler": "subroute",
 | |
| 									"routes": [
 | |
| 										{
 | |
| 											"handle": [
 | |
| 												{
 | |
| 													"handler": "vars",
 | |
| 													"root": "/srv"
 | |
| 												}
 | |
| 											]
 | |
| 										},
 | |
| 										{
 | |
| 											"handle": [
 | |
| 												{
 | |
| 													"error": "Unauthorized",
 | |
| 													"handler": "error",
 | |
| 													"status_code": 410
 | |
| 												}
 | |
| 											],
 | |
| 											"match": [
 | |
| 												{
 | |
| 													"path": [
 | |
| 														"/private*"
 | |
| 													]
 | |
| 												}
 | |
| 											]
 | |
| 										},
 | |
| 										{
 | |
| 											"handle": [
 | |
| 												{
 | |
| 													"error": "Not found",
 | |
| 													"handler": "error",
 | |
| 													"status_code": 404
 | |
| 												}
 | |
| 											],
 | |
| 											"match": [
 | |
| 												{
 | |
| 													"path": [
 | |
| 														"/hidden*"
 | |
| 													]
 | |
| 												}
 | |
| 											]
 | |
| 										}
 | |
| 									]
 | |
| 								}
 | |
| 							],
 | |
| 							"terminal": true
 | |
| 						}
 | |
| 					],
 | |
| 					"errors": {
 | |
| 						"routes": [
 | |
| 							{
 | |
| 								"match": [
 | |
| 									{
 | |
| 										"host": [
 | |
| 											"localhost"
 | |
| 										]
 | |
| 									}
 | |
| 								],
 | |
| 								"handle": [
 | |
| 									{
 | |
| 										"handler": "subroute",
 | |
| 										"routes": [
 | |
| 											{
 | |
| 												"handle": [
 | |
| 													{
 | |
| 														"body": "404 or 410 error",
 | |
| 														"handler": "static_response"
 | |
| 													}
 | |
| 												],
 | |
| 												"match": [
 | |
| 													{
 | |
| 														"expression": "{http.error.status_code} in [404, 410]"
 | |
| 													}
 | |
| 												]
 | |
| 											}
 | |
| 										]
 | |
| 									}
 | |
| 								],
 | |
| 								"terminal": true
 | |
| 							}
 | |
| 						]
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 	}
 | |
| }
 |