File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,14 @@ impl Router {
141141 . map ( |( _spec, handler) | ( & handler. parsed_based_route , & handler. component_id ) )
142142 }
143143
144+ /// true if one or more routes is under the reserved `/.well-known/spin/*`
145+ /// prefix; otherwise false.
146+ pub fn contains_reserved_route ( & self ) -> bool {
147+ self . router
148+ . iter ( )
149+ . any ( |( _spec, handker) | handker. based_route . starts_with ( crate :: WELL_KNOWN_PREFIX ) )
150+ }
151+
144152 /// This returns the component ID that should handle the given path, or an error
145153 /// if no component matches.
146154 ///
Original file line number Diff line number Diff line change @@ -90,6 +90,12 @@ impl<F: RuntimeFactors> HttpServer<F> {
9090 ) ;
9191 }
9292 }
93+ if router. contains_reserved_route ( ) {
94+ tracing:: error!(
95+ "Routes under {} are handled by the Spin runtime and will never be reached" ,
96+ spin_http:: WELL_KNOWN_PREFIX
97+ ) ;
98+ }
9399 tracing:: trace!(
94100 "Constructed router: {:?}" ,
95101 router. routes( ) . collect:: <Vec <_>>( )
You can’t perform that action at this time.
0 commit comments