using apache tomcat 8
spring mvc
tampermonkey
。
我在https
协议上运行的外部网站上执行了 ....
$.ajax({
url : 'http://localhost:8080/getfromFoo' , type : 'post',
success : function(data) {},
error : function(){ alert("error"); }
});
的脚本。
Mixed Content: The page at
'https://www.foo.com/'
was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint
'http://localhost:8080/getfromFoo'.
This request has been blocked; the content must be served over HTTPS.
我加入了chrome:
https
当我将ajax网址更改为url : 'https://localhost:8080/getfromFoo'
时https
改为POST https://localhost:8080/getfromFoo net::ERR_SSL_PROTOCOL_ERROR
XHR failed loading: POST "https://localhost:8080/getfromFoo".
:
apache tomcat
我进入nov. 20, 2015 12:31:41 PM org.apache.coyote.http11.AbstractHttp11Processor process
INFOS: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
日志:
{{1}}
答案 0 :(得分:0)
外部网站是https而你的不是。如果您要对https做请求,那么您应该通过https发出请求。 基本上我的意思是将你的tomcat切换到https。如果使用带有spring mvc的spring-boot,那么只需生成一个certifciate就可以了,并将它添加到这样的属性中。
server.port:8443
server.ssl.key-store: keystore.p12
server.ssl.key-store-password: somepass
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: tomcat
希望有所帮助