Tag: 跨域

ajax问题 – 在萤火虫中200 OK,但没有响应体的红色消息

我看到了与跨域相关的小ajax问题。 在localmachine上我用一些ajax创建了html示例:在注册文本字段中用户类型’username’,在每次击键时ajax将它发送到本地Tomcat,其中servlet检查该用户名是否已被使用并发送’take’响应。 在localhost上没问题。 只要我输入’username’,servlet就会发送’take’响应,浏览器会显示它。 但是,当我在远程机器上放置带有ajax的html页面(远程网络上的一些免费托管),在我的localhost Tomcat上发送validation请求时,建立连接,在Tomcat控制台中我看到请求即将发生,并且在Mozzila中的firebug中这是控制台输出继电器: GET http://89.216.182.25:8080/Dinamicki1/UsernameServlet?username=zik 200 OK …但是在响应选项卡中没有’采取’servlet响应,并且firebug中的消息是红色的 所以服务器通信良好,没有防火墙问题,响应是200 OK 但是反应机构是空的。 任何想法萤火虫中的这些红色信息是什么? 非常感谢你提前。 如果有人可以为java推荐一些严肃的ajax教程,将非常感谢:)

使用struts令牌进行跨站点请求防伪

我想为我的Web应用程序实现基于struts 1.x框架的跨站点请求防伪。 我知道struts 2框架为此提供了令牌拦截器,我可以使用filter实现类似的function。 我很少有人认为1)我怎么能用简单的方式生成独特的令牌呢? (我可以为此目的使用Action类令牌,用于避免重复的表单提交) 使用struts 1.x框架令牌机制进行CSRF预防是否有任何问题

具有跨域请求的重复Flex会话

当我在本地提出请求时,我没有任何问题维护我的FlexSession; 但是,当我从另一台计算机发出请求时,它会为每个请求创建重复的FlexSession。 我注意到每个请求的JSESSIONID都不同,这可能会导致欺骗性会话。 但我不知道为什么会这样。 我得到的具体错误是: Channel.Ping.Failed error Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly. 我的crossdomain.xml如下: 编辑: 我们在后端使用spring-flex集成。 此外,这发生在多个浏览器中; 我们尝试过IE,Firefox和Chrome。 这是Flex代码: var ro : RemoteObject = new RemoteObject(“myDestination”); ro.endpoint = “http://localhost/foo”; ro.source = “com.bar.MyService”; var op : AbstractOperation = […]

Spring Global CORS配置不起作用,但控制器级配置不起作用

我试图通过WebMvcConfigurerAdapter显示的WebMvcConfigurerAdapter全局配置CORS。 测试我通过我创建的小节点应用程序来模拟外部服务。 当我尝试这种方法时,响应不包含正确的标题并且失败 XMLHttpRequest cannot load http://localhost:8080/api/query/1121. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:333’ is therefore not allowed access. 全球配置 import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @EnableWebMvc @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping(“/api/query/**”) .allowedOrigins(“*”) .allowedHeaders(“*”) .allowCredentials(true); } } 但是,当我使用@CrossOrigin注释时,它可以很好地响应正确的标题。 @CrossOrigin(origins = […]

没有cookie的Spring安全会话

我正在尝试在不利用cookie的情况下管理Spring Security中的会话。 原因是 – 我们的应用程序显示在另一个域的iframe中,我们需要在我们的应用程序中管理会话, 并且Safari限制跨域co​​okie的创建 。 (上下文:domainA.com在iframe中显示domainB.com.domainB.com设置JSESSIONID cookie以在domainB.com上使用,但由于用户的浏览器显示domainA.com – Safari限制domainB.com创建cookie) 。 我能想到实现这一目标的唯一方法(针对OWASP安全建议) – 将URL中的JSESSIONID作为GET参数包含在内。 我不想这样做,但我想不出另一种选择。 所以这个问题都是关于: 有没有更好的替代方案来解决这个问题? 如果不是 – 我怎样才能通过Spring Security实现这一目标 回顾Spring的文档,使用enableSessionUrlRewriting应该允许这样做 所以我这样做了: @Override protected void configure(HttpSecurity http) throws Exception { http .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.ALWAYS) .enableSessionUrlRewriting(true) 这没有将JSESSIONID添加到URL,但现在应该允许它。 然后我利用此问题中的一些代码将“跟踪模式”设置为URL @SpringBootApplication public class MyApplication extends SpringBootServletInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); servletContext […]

docker十字架filter

我已配置Jetty的跨源filter,但我继续收到以下错误。 有谁知道什么是错的以及如何解决它? 错误消息下面是我的覆盖描述符(即补充web.xml) 错误: Origin http://localhost:8090 is not allowed by Access-Control-Allow-Origin. 覆盖描述符: cross-origin org.eclipse.jetty.servlets.CrossOriginFilter allowedOrigins * allowedMethods * allowedHeaders * cross-origin /* 请求标题 Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Access-Control-Request-Headers:Origin, Content-Type, Accept Access-Control-Request-Method:POST Connection:keep-alive Host:localhost:8080 Origin:http://localhost:8090 Referer:http://localhost:8090/home User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.8 (KHTML, like Gecko) Chrome/17.0.942.0 响应标题 Allow:POST,GET,OPTIONS,HEAD Content-Length:0 Date:Wed, 30 Nov 2011 02:13:21 GMT Server:Jetty(7.5.4.v20111024)