mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 02:27:19 -04:00 
			
		
		
		
	caddypki: Add 'acme_server' Caddyfile directive
This commit is contained in:
		
							parent
							
								
									97e61c16a3
								
							
						
					
					
						commit
						a285fe4129
					
				| @ -56,14 +56,15 @@ var directiveOrder = []string{ | ||||
| 
 | ||||
| 	// special routing directives | ||||
| 	"handle", | ||||
| 	"route", | ||||
| 	"handle_path", | ||||
| 	"route", | ||||
| 
 | ||||
| 	// handlers that typically respond to requests | ||||
| 	"respond", | ||||
| 	"reverse_proxy", | ||||
| 	"php_fastcgi", | ||||
| 	"file_server", | ||||
| 	"acme_server", | ||||
| } | ||||
| 
 | ||||
| // directiveIsOrdered returns true if dir is | ||||
|  | ||||
| @ -48,13 +48,20 @@ type Handler struct { | ||||
| 	// The hostname or IP address by which ACME clients | ||||
| 	// will access the server. This is used to populate | ||||
| 	// the ACME directory endpoint. Default: localhost. | ||||
| 	// TODO: this is probably not needed - check with smallstep | ||||
| 	// COMPATIBILITY NOTE / TODO: This property may go away in the | ||||
| 	// future, as it is currently only required due to | ||||
| 	// limitations in the underlying library. Do not rely | ||||
| 	// on this property long-term; check release notes. | ||||
| 	Host string `json:"host,omitempty"` | ||||
| 
 | ||||
| 	// The path prefix under which to serve all ACME | ||||
| 	// endpoints. All other requests will not be served | ||||
| 	// by this handler and will be passed through to | ||||
| 	// the next one. Default: "/acme/" | ||||
| 	// COMPATIBILITY NOTE / TODO: This property may go away in the | ||||
| 	// future, as it is currently only required due to | ||||
| 	// limitations in the underlying library. Do not rely | ||||
| 	// on this property long-term; check release notes. | ||||
| 	PathPrefix string `json:"path_prefix,omitempty"` | ||||
| 
 | ||||
| 	acmeEndpoints http.Handler | ||||
|  | ||||
							
								
								
									
										38
									
								
								modules/caddypki/acmeserver/caddyfile.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								modules/caddypki/acmeserver/caddyfile.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| // Copyright 2015 Matthew Holt and The Caddy Authors | ||||
| // | ||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| // you may not use this file except in compliance with the License. | ||||
| // You may obtain a copy of the License at | ||||
| // | ||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | ||||
| // | ||||
| // Unless required by applicable law or agreed to in writing, software | ||||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | ||||
| 
 | ||||
| package acmeserver | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" | ||||
| 	"github.com/caddyserver/caddy/v2/modules/caddyhttp" | ||||
| ) | ||||
| 
 | ||||
| func init() { | ||||
| 	httpcaddyfile.RegisterHandlerDirective("acme_server", parseACMEServer) | ||||
| } | ||||
| 
 | ||||
| // parseACMEServer sets up an ACME server handler from Caddyfile tokens. | ||||
| // | ||||
| //     acme_server [<matcher>] | ||||
| // | ||||
| func parseACMEServer(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) { | ||||
| 	var as Handler | ||||
| 	for h.Next() { | ||||
| 		if h.NextArg() { | ||||
| 			return nil, h.ArgErr() | ||||
| 		} | ||||
| 	} | ||||
| 	return as, nil | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user