Apache Coldfusion 11 REST服务使用HTTP,但不使用HTTPS(404)
我试图利用Coldfusion 11的REST服务,但我只能使用HTTP,而不能使用HTTPS。当我将协议更改为HTTPS时,它返回404 我已采取的步骤: 1) 我在web根目录中创建了一个名为“api测试”的文件夹 2) 在该文件夹中,我创建了一个名为“animals.cfc”的文件,其中包含:Apache Coldfusion 11 REST服务使用HTTP,但不使用HTTPS(404),apache,web-services,rest,tomcat,coldfusion,Apache,Web Services,Rest,Tomcat,Coldfusion,我试图利用Coldfusion 11的REST服务,但我只能使用HTTP,而不能使用HTTPS。当我将协议更改为HTTPS时,它返回404 我已采取的步骤: 1) 我在web根目录中创建了一个名为“api测试”的文件夹 2) 在该文件夹中,我创建了一个名为“animals.cfc”的文件,其中包含: <cfcomponent rest="true" restpath="/animals"> <cffunction name="getAnimals" access
<cfcomponent rest="true" restpath="/animals">
<cffunction name="getAnimals" access="remote" httpmethod="GET" produces="application/json" returntype="struct">
<cfset value = { "cats": "dogs", "birds": "snakes" }>
<cfreturn value>
</cffunction>
</cfcomponent>
返回的数据没有问题
5) 在我的web浏览器中,当我将CF web应用程序的协议更改为HTTPS,并重试相同的命令(但使用HTTPS)时,我得到一个404
$.get("https://cftestapp1.mydomain.com/rest/api-test/animals");
我的环境由负载平衡器(cftestapps)后面的两个web服务器(cftestapp1和cftestapp2)组成。web服务器在使用Apache/Tomcat的Redhat Linux上运行Coldfusion 11。在整个测试过程中,我首先尝试了负载平衡器的所有功能,当它不起作用时,我只关注“cftestapp1”(如上面的示例)。我仔细检查了所有Coldfusion管理员设置和Apache httpd.conf文件,结果是空的
我在网上找不到太多的文档,也找不到任何有类似问题的人。如果有人有任何见解,请帮助!!谢谢
编辑: 每次我发出HTTPS请求时,/etc/httpd/logs/ssl\u error\u log(在httpd.conf中指定)都会显示以下错误: [2015年11月24日星期二16:34:23][error][client my_ip_here]文件不存在:/web/webapps/rest
[Tue Nov 24 16:34:23 2015][error][client my_ip_here]文件不存在:/web/webapps/opt /web/webapps/rest是我请求的资源;但是,没有物理文件“rest”;我在Coldfusion管理员Rest服务中的条目应该处理这些重定向 /web/webapps/opt似乎是Apache为404页面提供服务的尝试,该页面不在web根目录中,而是在/opt目录的深处 我还发现了这个错误,可能与此无关,因为在添加CF Rest服务之前,我们的HTTPS请求从未出现过问题 [11月24日星期二16:33:12 2015][warn]RSA服务器证书是CA证书(基本约束:CA==TRUE!) 下面是Apache配置文件(httpd.conf)的一个片段。还有很多行,但这些似乎是最相关的
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/web/webapps">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Include "/etc/httpd/conf/mod_jk.conf"
NameVirtualHost 127.0.0.1:443
<VirtualHost 127.0.0.1:443>
ServerName localhost
DocumentRoot /web/webapps/
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLProtocol +SSLv3 +TLSv1
SSLCipherSuite RSA:!EXP:!NULL:+HIGH:-MEDIUM:-LOW
ErrorLog logs/cfadmin.ssl.error.log
CustomLog logs/cfadmin.ssl.access.log common
</VirtualHost>
ErrorDocument 404 /opt/cf11/cfusion/wwwroot/CFIDE/administrator/templates/404.cfm
选项如下符号链接
不允许超限
选项如下符号链接
不允许超限
命令允许,拒绝
通融
包括“/etc/httpd/conf/mod_jk.conf”
NameVirtualHost 127.0.0.1:443
服务器名本地主机
DocumentRoot/web/webapps/
斯伦金安
SSLCertificateFile/etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile/etc/pki/tls/private/localhost.key
SSLProtocol+SSLv3+TLSv1
SSLCipherSuite RSA:!经验:!空:+高:-中:-低
ErrorLog日志/cfadmin.ssl.error.log
CustomLog日志/cfadmin.ssl.access.log公共
错误文档404/opt/cf11/cfusion/wwwroot/CFIDE/administrator/templates/404.cfm
似乎404和REST服务的HTTPS通信没有正确路由。但是我可以在使用HTTPS时访问我们/web/webappsweb根目录中的所有其他文件夹,而不会出现任何问题。您的虚拟主机对ColdFusion一无所知。如果查看
/etc/httpd/conf/mod_jk.conf
文件,它将有一行如下所示:
JKMountFile "/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
它是为HTTP服务调用的(通过配置文件的Include”/etc/httpd/conf/mod_jk.conf“
),而不是为HTTPS服务调用的
您只需将这一行复制到虚拟主机声明中的httpd.conf
文件中;像这样:
<VirtualHost 127.0.0.1:443>
ServerName localhost
DocumentRoot /web/webapps/
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLProtocol +SSLv3 +TLSv1
SSLCipherSuite RSA:!EXP:!NULL:+HIGH:-MEDIUM:-LOW
ErrorLog logs/cfadmin.ssl.error.log
CustomLog logs/cfadmin.ssl.access.log common
JKMountFile "/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
</VirtualHost>
服务器名本地主机
DocumentRoot/web/webapps/
斯伦金安
SSLCertificateFile/etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile/etc/pki/tls/private/localhost.key
SSLProtocol+SSLv3+TLSv1
SSLCipherSuite RSA:!经验:!空:+高:-中:-低
ErrorLog日志/cfadmin.ssl.error.log
CustomLog日志/cfadmin.ssl.access.log公共
JKMountFile“/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties”
然后虚拟主机将知道在哪里可以找到服务。我的问题已经解决。我发现了两种不同的解决方案,它们基于mt0和Adobe的帮助()的响应 解决方案#1 编辑/etc/httpd/conf/httpd.conf 我在SSL VirtualHost指令中添加了以下行:
<VirtualHost 127.0.0.1:443>
JKMountFile "/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
虽然这解决了问题,但我不想在配置文件中硬编码服务器的IP地址。因此我继续研究并找到了另一种解决方案:
解决方案#2(首选)
编辑/etc/httpd/conf.d/ssl.conf(使httpd.conf文件保持其原始状态)
我在SSL VirtualHost指令中添加了以下行,并重新启动了Apache:
<VirtualHost _default_:443>
JKMountFile "/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
JKMountFile“/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties”
这解决了我的问题
谢谢大家的帮助 如果您只需访问URL
https://cftestapp1.mydomain.com/rest/api-test/animals
在您的浏览器中?我意识到它可能会出现错误或类似的情况,但它解决了吗?您是否已将证书导入到服务器上的java密钥库文件(cacerts)中?将SSL证书添加到我们的密钥库中并没有解决此问题。但事实证明,直接在web浏览器中点击URL更容易:使用HTTP,它会显示JSON。通过HTTPS,我得到Apache的404页面。但是如果我在/rest/使用HTTPhttp://cftestapp1.mydomain.com/rest/api-test-break-me/animals
,我得到一张空白页。如果我在/rest/使用HTTPhttps://cftestapp1.mydomain.com/break-me/rest/api-test/animals
,我得到Coldfusion的404错误。这可能是我们Apa的一个问题
NameVirtualHost SERVER_IP_HERE:443
<VirtualHost SERVER_IP_HERE:443>
<VirtualHost _default_:443>
JKMountFile "/path/to/ColdFusion11/config/wsconfig/1/uriworkermap.properties"