ColdFusion 2016: Can you have a folder in your web root named 'api' or 'rest'?

非 Y 不嫁゛ 提交于 2020-02-23 10:22:12

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/39903025/coldfusion-2016-can-you-have-a-folder-in-your-web-root-named-api-or-rest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!