【发布时间】:2018-02-19 13:45:48
【问题描述】:
我正在尝试使用 FW/1 使用子系统在 ColdFusion 中设置 API 站点。我想设置路由以省略 index.cfm 并使用 /subsystem/action/item 作为默认路径,但我不确定是否有办法做到这一点。文档不是很清楚,从我能找到的内容和其他问题都非常古老。
现在,我的 Application.cfc 中有以下内容...
variables.framework = {
trace = false,
reloadApplicationOnEveryRequest = "true",
home = "main.default",
diComponent = "framework.ioc",
diLocations = "/model,/controllers",
SESOmitIndex = true
};
variables.framework.routes = [
{ "$GET/accounts:member/membercount" = "/account/member/membercount" }
];
这会导致 IIS 中出现 404 错误。有什么建议吗?
更新:我确实发现我需要更新 IIS 以包含 URL 重写以省略 index.cfm,但是,当我尝试调用 http://example.com/account/member/membercount 时仍然得到 404
如果我将 URL 更改为 http://example.com/account:member/membercount,我会收到一个 IIS 错误,“检测到来自客户端 (:) 的潜在危险 Request.Path 值”。
我更愿意以第一种方式调用 URL,使用“/”而不是“:”,但我不知道该怎么做。似乎路线应该能够处理这个问题,但我到目前为止还没有找到方法。
【问题讨论】:
-
account或accounts?您的Application.cfcsn-p 表示帐户。你的示例链接最后没有s -
我只是在玩 FW1 中的子系统并纯粹偶然地搜索互联网我回到这个问题。我曾期望像
{ "$GET/accounts/member/membercount/$" = "/account:member.membercount" }这样的东西会起作用,但它在我的设置中不起作用。可能与路径信息到达应用程序服务器的方式有关。有一些可能的故障点。
标签: routing frameworks cfml subsystem