是否可以在每个路由的基础上将 uri-parsing-mode 更改为 relaxed-with-raw-query?

Is it possible to change uri-parsing-mode to relaxed-with-raw-query on a per route basis?

是否可以将每个路线的 uri-parsing-mode 更改为 relaxed-with-raw-query?如果我在 application.conf 中更改它,它会针对所有路线进行更改,但我只需要在一条路线中使用它

不是,因为解析是在路由之前完成的,所以已经决定了。但是,您可以做的是切换 spray.can.server.raw-request-uri-header = on。这将为每个请求添加一个自定义 header,您可以在您对原始详细信息感兴趣的路径中检查这些请求。

有关设置的说明,请参阅 https://github.com/spray/spray/blob/master/spray-can/src/main/resources/reference.conf#L76