我需要一些帮助与我的Spring安全4.2 CORS配置。
调用Spring Security登录页时http://localhost:8080/login,未在飞行前请求上设置CORS标头。
调用不同的URL时,CORS标头设置正确。
浏览器控制台错误消息:
对飞行前请求的响应未通过访问控制检查:请求的资源上不存在“access control Allow Origin”标头。
Spring安全4.2
<!-- Main security configuration -->
<security:http entry-point-ref="mainEntryPoint">
<security:cors configuration-source-ref="corsSource"/>
<!-- Handle CORS (preflight OPTIONS requests must be anonymous) -->
<security:intercept-url method="OPTIONS" pattern="/**" access="isAnonymous()"/>
<security:intercept-url pattern="/main/**" access="hasRole('USER')"/>
<security:intercept-url pattern="/**" access="denyAll"/>
<security:custom-filter position="LOGOUT_FILTER" ref="mainLogoutFilter"/>
<security:csrf disabled="true"/>
</security:http>
(...)
<bean id="corsSource" class="org.springframework.web.cors.UrlBasedCorsConfigurationSource">
<property name="corsConfigurations">
<map>
<entry key="/**">
<bean class="org.springframework.web.cors.CorsConfiguration">
<property name="allowCredentials" value="true"/>
<property name="allowedHeaders" value="*"/>
<property name="allowedMethods" value="*"/>
<property name="allowedOrigins" value="http://localhost:4200"/>
<property name="maxAge" value="86400"/>
</bean>
</entry>
</map>
</property>
</bean>
我在另一个文件中发现登录路径配置被覆盖。所以这个问题是针对我的项目的。
<security:http pattern="/login">
</security:http>
我将发布一个工作配置的示例。
问题内容: 我知道这个问题已经问过几次了。 但是,我无法获得这些解决方案。 我正在运行标准安装的node.js和socket.io。(来自Amazon EC2上的yum) 问题是Chrome退回到xhr轮询,并且这些请求需要有效的CORS配置。但是,我似乎无法正常工作。我的Web服务器在端口80上运行,而node.js(socket.io)在端口81上运行。如您所见,我试图使socket.io使用
我正在尝试在PHP服务器上允许CORS我有以下代码 和一个使用jquery获取它的简单ajax请求 我在我的开发工具上不断得到这个CORS错误 HTTP/1.1 200 OK日期:Mon,31 Aug 2015 17:25:33 GMT Content-Type:Text/HTML Content-Length:97 连接:Keep-alive Keep-alive:Timeout=30 服务器:
我正在设置Angular Spring Security模块来登录和注册用户。当我注册一个用户时,一切都正常。注册后的最后一步是自动登录,但我遇到了以下错误: XMLHttpRequest无法加载超文本传输协议//localhost:8080/com-tesis/login.请求的资源上不存在“访问控制允许起源”标头。因此不允许访问起源“超文本传输协议//localhost:9000”。响应的HT
本文向大家介绍Vue设置长时间未操作登录自动到期返回登录页,包括了Vue设置长时间未操作登录自动到期返回登录页的使用技巧和注意事项,需要的朋友参考一下 Vue设置长时间未操作登录以后自动到期返回登录页 首先我们写在main.js文件中 我们会在登陆成功后调用sessionUtil文件中的setSession,sessionUtil下面写的有 在routerutil.js文件中 在sessionut
我有一个由Tomcat托管的静态网站。 如何为我的网站设置标头,例如: 它们都是静态文件,而不是任何servlet应用程序。
springsecurity oauth2.0 谁做过记录登录日志?监听事件好像没法区分是什么原因失败的、比如client错误还是用户名错误