The routes /ping, /testb, and testc are all valid and served by the application.
Current Behavior
The /ping route is served (all the services defined directly in the top-level scope in general).
The /testb route is served, but not the /testc one; only the first sub-scope is served: if we inverse the order of definition (see bellow), then the /testc route is served but not the /testb
This behaviour is only present if the two sub-scope have the same path or if one of the subscope is set to the "root path" (/) and is defined first :
web::scope("/")
.service(ping) // served
.service(b::router()) // served (root)
.service(c::router()) // not served (root)
web::scope("/")
.service(ping) // served
.service(c::router()) // served (root)
.service(b::router()) // not served (root)
web::scope("/")
.service(ping) // served
.service(d::router()) // served (/smth/)
.service(c::router()) // served (root)
web::scope("/")
.service(ping) // served
.service(c::router()) // served
.service(d::router()) // not served (/smth/)
Context
The only solution I found was not to use any "root" sub-scope. Though I haven't found anything in the documentation preventing me from using the root path in a sub-scope (and the application compiles & run fine).
Let's consider the following setup:
Expected Behavior
The routes
/ping
,/testb
, andtestc
are all valid and served by the application.Current Behavior
The
/ping
route is served (all the services defined directly in the top-level scope in general). The/testb
route is served, but not the/testc
one; only the first sub-scope is served: if we inverse the order of definition (see bellow), then the/testc
route is served but not the/testb
This behaviour is only present if the two sub-scope have the same path or if one of the subscope is set to the "root path" (
/
) and is defined first :Context
The only solution I found was not to use any "root" sub-scope. Though I haven't found anything in the documentation preventing me from using the root path in a sub-scope (and the application compiles & run fine).
Your Environment
Rust 1.53
rustc 1.53.0 (53cb7b09b 2021-06-17)
Actix-Web 3 & 4.0.0-beta.8