公司老的项目使用是php,要进行重构。其他团队使用php curl函数使用post方式调用Spring Cloud gateway 报time out错误。

但是使用postman测试是没有任何问题,php curl如果绕过网关直接访问接口也没有问题。结果发现了是因为:

使用Curl POST数据时,如果POST的数据大于1024字节,Curl并不会直接发起POST请求,而是分两步:

1、发送一个请求,Header中包含一个Expect:100-continue,询问Server是否愿意接受数据
2、接受到Server返回的100-continue回应后,才把数据Post到Server

这个也是Spring Cloud gateway一个Bug:https://github.com/spring-cloud/spring-cloud-gateway/issues/273

解决办法:配置路由转发的时候,去掉expect request Header

 .route("openapi_route", p -> p.path(ORDER_CENTER_API + "/openapi/**").filters(f->f.removeRequestHeader("Expect"))
.uri("lb://order-xxxxx-service"))

curl使用post方式访问Spring Cloud gateway报time out错误的更多相关文章

  1. Spring Cloud Gateway报错:Unable to start embedded Tomcat

    最近搭建Spring Cloud Gateway时启动项目出现如下报错信息: Error starting ApplicationContext. To display the conditions ...

  2. Spring Cloud Gateway服务网关

    原文:https://www.cnblogs.com/ityouknow/p/10141740.html Spring 官方最终还是按捺不住推出了自己的网关组件:Spring Cloud Gatewa ...

  3. 网关服务Spring Cloud Gateway(一)

    Spring 官方最终还是按捺不住推出了自己的网关组件:Spring Cloud Gateway ,相比之前我们使用的 Zuul(1.x) 它有哪些优势呢?Zuul(1.x) 基于 Servlet,使 ...

  4. 微服务网关实战——Spring Cloud Gateway

    导读 作为Netflix Zuul的替代者,Spring Cloud Gateway是一款非常实用的微服务网关,在Spring Cloud微服务架构体系中发挥非常大的作用.本文对Spring Clou ...

  5. 跟我学SpringCloud | 第十二篇:Spring Cloud Gateway初探

    SpringCloud系列教程 | 第十二篇:Spring Cloud Gateway初探 Springboot: 2.1.6.RELEASE SpringCloud: Greenwich.SR1 如 ...

  6. spring cloud:服务网关 Spring Cloud GateWay 入门

    Spring 官方最终还是按捺不住推出了自己的网关组件:Spring Cloud Gateway ,相比之前我们使用的 Zuul(1.x) 它有哪些优势呢?Zuul(1.x) 基于 Servlet,使 ...

  7. Spring Cloud Gateway入门

    1.什么是Spring Cloud GatewaySpring Cloud Gateway是Spring官方基于Spring 5.0,Spring Boot 2.0和Project Reactor等技 ...

  8. Spring Cloud Gateway重试机制

    前言 重试,我相信大家并不陌生.在我们调用Http接口的时候,总会因为某种原因调用失败,这个时候我们可以通过重试的方式,来重新请求接口. 生活中这样的事例很多,比如打电话,对方正在通话中啊,信号不好啊 ...

  9. Spring Cloud Alibaba学习笔记(15) - 整合Spring Cloud Gateway

    Spring Cloud Gateway 概述 Spring Cloud Gateway 是 Spring Cloud 的一个全新项目,该项目是基于Netty.Reactor以及WEbFlux构建,它 ...

随机推荐

  1. js实现开关灯游戏

    需求: 点击三个按钮,页面出现不同数量的“灯” 所有的灯有相同的点击效果.点击一个灯的时候,this和他的上下左右都会变成另一种背景色. 代码在这里~~~ 文章地址 https://www.cnblo ...

  2. Educational Codeforces Round 7、

    A - Infinite Sequence 题意:有一种这样的无限序列数 1,1,2,1,2,3.....   (如果最大数n,那么就有从1到n的所有1到n的数): 思路:题意只给了1秒.直接模拟肯定 ...

  3. Java5新特性对数组的支持

    增强for循环 → for-each for (参数类型参数名 : 数组名) { 代码块 } Eg: package reviewDemo; public class Demo6 { public s ...

  4. Python--day42--MySQL外键定义及创建

    什么是外键? 外键的创建:constraint 外键名 foregin key ("表1值1",“ 表1值2”) references 表2的名字(“值1”)

  5. 基于@AspectJ注解配置切面与基于XML配置切面

    1. Waiter目标类 package com.smart.aop.advice.pointcut; public class Waiter { public void greetTo(String ...

  6. 为什么有的文件从SVN上更新不下来

    前几天使用eclipse的插件从SVN上更新代码,将全部的代码更新下来后启动项目,前台报错说有些js文件找不到,后来检查我的工程里确实没有那些文件,经过检查发现SVN上却有这些文件,那为什么更新不下来 ...

  7. 安装 Sureface Hub 系统 Windows 10 team PPIPro 系统

    本文告诉大家如何安装这个系统 本文的方法我自己没试过,如果失败了,不要打我 下载地址 中文版 https://pan.baidu.com/s/1gAJSSE6KB9JHXo4BT_VfmA 其他请看 ...

  8. tf.truncates_normal()

    转载自:https://blog.csdn.net/uestc_c2_403/article/details/72235565 tf.truncated_normal(shape, mean, std ...

  9. Apply,Call,bind对比

    apply.call call和apply都是为了改变上下文背景存在的,即改变函数内部指向 javascript一大特点是函数存在定义时的上下文,运行时的上下文和上下文可改变的概念 apply.cal ...

  10. Maven工程

    maven:父子工程 1,父工程并没有实质性的内容,所有的jar包都在里面,也就是说只需要管理jar包即可,不参与任务方法逻辑 2,在父工程中拥有很多的子模块,每一个子模块都代表了不用的包如(pack ...