ColdFusion 2016:您的网络根目录中可以有一个名为"api"或"rest"的文件夹吗? [英] ColdFusion 2016: Can you have a folder in your web root named 'api' or 'rest'?

查看:101
本文介绍了ColdFusion 2016:您的网络根目录中可以有一个名为"api"或"rest"的文件夹吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了ColdFusion 2016(从CF10升级),我注意到,每当尝试访问Web根目录中的名为"api"的文件夹时,都会收到内部500错误.

例如:www.mysite.com/api/

我认为这与新的ColdFusion API REST服务有关,因此我创建了另一个名为"rest"的目录,执行了相同的测试(www.mysite.com/rest/),并收到了另一个500错误./p>

请参阅IIS错误屏幕截图:

奇怪的是,我没有使用ColdFusion REST服务,也没有在ColdFusion Administrator中启用它.

我的问题:

是否允许您在Web根目录中不再使用名为"api"或"rest"的文件夹名称?还是这些现在保留的文件夹名称?有没有针对特定站点禁用此功能的解决方法,以便我可以使用这些文件夹名称?

解决方案

在Adobe论坛上看到了这一点,它应该回答您的问题:

无法访问/api/或/rest/的原因是因为这些文件夹具有cf servlet映射.

您可以通过转到cfinstall/cfusion/wwwroot/WEB-INF/web.xml删除映射.搜索api servlet映射并将其注释掉.

除了使用IIS重写将流量重定向到另一个文件夹外,似乎没有办法对特定站点执行此操作.这样的事情应该起作用(将流量从/api/重定向到/api2/):

<rule name="Redirect" stopProcessing="true">
     <match url="^api$|^api/(.*)" />
     <action type="Rewrite" url="api2/{R:1}" appendQueryString="true" />
</rule>

如果有人知道在不修改web.config的情况下禁用特定网站的方法,请随时分享您的想法.

I just installed ColdFusion 2016 (upgraded from CF10) and I noticed that whenever I try and access a folder in my webroot called 'api', I get an internal 500 error.

For example: www.mysite.com/api/

I assume this has something to do with the new ColdFusion API REST service so I created another directory called 'rest', performed the same test (www.mysite.com/rest/), and received yet another 500 error.

See the IIS error screenshot:

The strange thing is that I don't use the ColdFusion REST service and I don't have it enabled in ColdFusion Administrator.

My Question:

Are you allowed to have folder names in your web root named "api" or "rest" anymore? Or are these now reserved folder names? Is there a workaround to disable this feature for a specific site so I can use these folder names?

解决方案

Saw this on the Adobe Forums which should answer your question:

The reason you can't access /api/ or /rest/ is because there is a cf servlet-mapping for those folders.

You can remove the mapping by going to cfinstall/cfusion/wwwroot/WEB-INF/web.xml. Search for the api servlet-mapping and comment it out.

There doesn't seem to be a way to do this for a specific site other than using IIS rewrite to redirect traffic to another folder. Something like this should work (redirects traffic from /api/ to /api2/):

<rule name="Redirect" stopProcessing="true">
     <match url="^api$|^api/(.*)" />
     <action type="Rewrite" url="api2/{R:1}" appendQueryString="true" />
</rule>

if anyone knows a way to disable this for a specific site without modifying web.config please feel free to share your ideas.

这篇关于ColdFusion 2016:您的网络根目录中可以有一个名为"api"或"rest"的文件夹吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆