在 K8s 中 HTTP 响应 502,message:An invalid response was received from the upstream server

1、在 K8s 中 HTTP 响应 502 Bad Gateway,message:An invalid response was received from the upstream server。从上游服务器收到无效响应。502 Bad Gateway 错误具体表示服务器收到来自入站服务器的无效响应。kong/2.5.0。如图1

在 K8s 中 HTTP 响应 502 Bad Gateway,message:An invalid response was received from the upstream server。从上游服务器收到无效响应。502 Bad Gateway 错误具体表示服务器收到来自入站服务器的无效响应。kong/2.5.0。

图1

2、原因在于 GET 请求参数过多,参数量过大。参数总字数超过 1300 个。


{{host_info}}{{base_url}}/v{{module}}/task-group-channel-app-sources?filter[group_id]={{group_id}}&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&filter[channel_type_code][in][19]=vtt_cashtoutiao&filter[channel_type_code][in][20]=vtt_dianping&filter[channel_type_code][in][21]=vtt_weibo&filter[channel_type_code][in][22]=vtt_sina&filter[channel_type_code][in][23]=vtt_iqiyi&filter[channel_type_code][in][24]=vtt_toutiao_pro&filter[channel_type_code][in][25]=vtt_bilibili&filter[channel_type_code][in][26]=vtt_netease&filter[channel_type_code][in][27]=vtt_sogou&per-page=100&group_id={{group_id}}


filter[channel_type_code][in][0]:vtt_douyin
filter[channel_type_code][in][1]:vtt_douyin_pro
filter[channel_type_code][in][2]:vtt_kuaishou
filter[channel_type_code][in][3]:vtt_kuaishou_pro
filter[channel_type_code][in][4]:vtt_baijia
filter[channel_type_code][in][5]:vtt_baijia_pro
filter[channel_type_code][in][6]:vtt_dayu
filter[channel_type_code][in][7]:vtt_dayu_pro
filter[channel_type_code][in][8]:vtt_qq
filter[channel_type_code][in][9]:vtt_yidian
filter[channel_type_code][in][10]:vtt_qutoutiao
filter[channel_type_code][in][11]:vtt_miaopai
filter[channel_type_code][in][12]:vtt_meipai
filter[channel_type_code][in][13]:vtt_rrtv
filter[channel_type_code][in][14]:vtt_sohutv
filter[channel_type_code][in][15]:vtt_sohu
filter[channel_type_code][in][16]:vtt_acfun
filter[channel_type_code][in][17]:vtt_yinyuetai
filter[channel_type_code][in][18]:vtt_neteasemusic
filter[channel_type_code][in][19]:vtt_cashtoutiao
filter[channel_type_code][in][20]:vtt_dianping
filter[channel_type_code][in][21]:vtt_weibo
filter[channel_type_code][in][22]:vtt_sina
filter[channel_type_code][in][23]:vtt_iqiyi
filter[channel_type_code][in][24]:vtt_toutiao_pro
filter[channel_type_code][in][25]:vtt_bilibili
filter[channel_type_code][in][26]:vtt_netease
filter[channel_type_code][in][27]:vtt_sogou

3、总计 28 个请求参数,删减为 14 个。响应 200。如图2

总计 28 个请求参数,删减为 14 个。响应 200。

图2

4、查看容器中的 Nginx 日志,确定接口响应 502 时候,实际是响应 200 的。如图3

查看容器中的 Nginx 日志,确定接口响应 502 时候,实际是响应 200 的。

图3

{"environment-info":{"pod-id":"api-7cc8cc4c9c-hx89x","namespace":"ccp","pod-ip":"10.42.4.155","pod-hostip":"192.168.3.14"},"request":{"headers":{"referer":"-","host":"api.ccp","x-request-id":"156f0a80cc88c1ee0bb79b1f06d777f1","x-forwarded-for":"101.207.139.251, 10.42.0.231","user-agent":"PostmanRuntime/7.28.4"},"method":"GET","uri":"/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&filter[channel_type_code][in][19]=vtt_cashtoutiao&filter[channel_type_code][in][20]=vtt_dianping&filter[channel_type_code][in][21]=vtt_weibo&filter[channel_type_code][in][22]=vtt_sina&filter[channel_type_code][in][23]=vtt_iqiyi&filter[channel_type_code][in][24]=vtt_toutiao_pro&filter[channel_type_code][in][25]=vtt_bilibili&filter[channel_type_code][in][26]=vtt_netease&filter[channel_type_code][in][27]=vtt_sogou&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753","url":"http://api.ccp/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&filter[channel_type_code][in][19]=vtt_cashtoutiao&filter[channel_type_code][in][20]=vtt_dianping&filter[channel_type_code][in][21]=vtt_weibo&filter[channel_type_code][in][22]=vtt_sina&filter[channel_type_code][in][23]=vtt_iqiyi&filter[channel_type_code][in][24]=vtt_toutiao_pro&filter[channel_type_code][in][25]=vtt_bilibili&filter[channel_type_code][in][26]=vtt_netease&filter[channel_type_code][in][27]=vtt_sogou&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753","@timestamp":"2021-09-30T13:28:24+08:00","upstreamaddr":"127.0.0.1:9000","response":{"responsetime":"0.430","upstream-response-time":"0.430"},"size":"0","status":"200"},"module-name":"default_ccp_api"}

5、决定在另外一台容器中调用此接口,跳过 Kong 网关。报错:curl: (3) [globbing] error: bad range specification after pos 60。如图4

决定在另外一台容器中调用此接口,跳过 Kong 网关。报错:curl: (3) [globbing] error: bad range specification after pos 60。

图4

curl "http://api.ccp:82/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&filter[channel_type_code][in][19]=vtt_cashtoutiao&filter[channel_type_code][in][20]=vtt_dianping&filter[channel_type_code][in][21]=vtt_weibo&filter[channel_type_code][in][22]=vtt_sina&filter[channel_type_code][in][23]=vtt_iqiyi&filter[channel_type_code][in][24]=vtt_toutiao_pro&filter[channel_type_code][in][25]=vtt_bilibili&filter[channel_type_code][in][26]=vtt_netease&filter[channel_type_code][in][27]=vtt_sogou&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753"

6、将 [ 与 ] 前面添加 /,最终请求,响应成功。如图5

将 [ 与 ] 前面添加 /,最终请求,响应成功。

图5

[root@api-console-migrate-6fc4566467-qbfch /]# curl "http://api.ccp:82/v1/task-group-channel-app-sources?filter/[group_id/]=6c8b55e7387da4799772ddb389f06753&filter/[channel_type_code/]/[in/]/[0/]=vtt_douyin&filter/[channel_type_code/]/[in/]/[1/]=vtt_douyin_pro&filter/[channel_type_code/]/[in/]/[2/]=vtt_kuaishou&filter/[channel_type_code/]/[in/]/[3/]=vtt_kuaishou_pro&filter/[channel_type_code/]/[in/]/[4/]=vtt_baijia&filter/[channel_type_code/]/[in/]/[5/]=vtt_baijia_pro&filter/[channel_type_code/]/[in/]/[6/]=vtt_dayu&filter/[channel_type_code/]/[in/]/[7/]=vtt_dayu_pro&filter/[channel_type_code/]/[in/]/[8/]=vtt_qq&filter/[channel_type_code/]/[in/]/[9/]=vtt_yidian&filter/[channel_type_code/]/[in/]/[10/]=vtt_qutoutiao&filter/[channel_type_code/]/[in/]/[11/]=vtt_miaopai&filter/[channel_type_code/]/[in/]/[12/]=vtt_meipai&filter/[channel_type_code/]/[in/]/[13/]=vtt_rrtv&filter/[channel_type_code/]/[in/]/[14/]=vtt_sohutv&filter/[channel_type_code/]/[in/]/[15/]=vtt_sohu&filter/[channel_type_code/]/[in/]/[16/]=vtt_acfun&filter/[channel_type_code/]/[in/]/[17/]=vtt_yinyuetai&filter/[channel_type_code/]/[in/]/[18/]=vtt_neteasemusic&filter/[channel_type_code/]/[in/]/[19/]=vtt_cashtoutiao&filter/[channel_type_code/]/[in/]/[20/]=vtt_dianping&filter/[channel_type_code/]/[in/]/[21/]=vtt_weibo&filter/[channel_type_code/]/[in/]/[22/]=vtt_sina&filter/[channel_type_code/]/[in/]/[23/]=vtt_iqiyi&filter/[channel_type_code/]/[in/]/[24/]=vtt_toutiao_pro&filter/[channel_type_code/]/[in/]/[25/]=vtt_bilibili&filter/[channel_type_code/]/[in/]/[26/]=vtt_netease&filter/[channel_type_code/]/[in/]/[27/]=vtt_sogou&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753"
{"code":10000,"message":"获取任务组的渠道的应用的来源的树形列表成功","data":{"items":[{"channel_code":"douyin","channel_name":"抖音","channel_type_code":"vtt_douyin_pro","channel_type_name":"视频兔兔的抖音PRO应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"60e74fd01f6711ecaded82f5728d7d34","channel_code":"douyin","channel_type_code":"vtt_douyin_pro","name":"小燕子","avatar":"https://p3.douyinpic.com/aweme/1080x1080/31a3d00061fd573c41210.jpeg?from=4010531038","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632728941,"is_pub_able":1,"is_pub_message":"","channel_name":"抖音","channel_type_name":"视频兔兔的抖音PRO应用","channel_app_name":"小燕子"}]},{"channel_code":"kuaishou","channel_name":"快手","channel_type_code":"vtt_kuaishou_pro","channel_type_name":"视频兔兔的快手PRO应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"4be7fa9e1f6711ecb02ca571b56d3826","channel_code":"kuaishou","channel_type_code":"vtt_kuaishou_pro","name":"User_1611141497927","avatar":"http://head-img.videototo.com/new_100009445_kuaishoupro_100025305","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632728906,"is_pub_able":1,"is_pub_message":"","channel_name":"快手","channel_type_name":"视频兔兔的快手PRO应用","channel_app_name":"User_1611141497927"}]},{"channel_code":"toutiao","channel_name":"头条号","channel_type_code":"vtt_toutiao_pro","channel_type_name":"视频兔兔的头条号PRO应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"9af35d8a1f6311ecb6b115ad3c194da2","channel_code":"toutiao","channel_type_code":"vtt_toutiao_pro","name":"编辑器验证","avatar":"https://p3-passport.byteacctimg.com/img/user-avatar/2x_21863502d9f118168ad71160d7070b7b~300x300.image","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632727321,"is_pub_able":1,"is_pub_message":"","channel_name":"头条号","channel_type_name":"视频兔兔的头条号PRO应用","channel_app_name":"编辑器验证"}]},{"channel_code":"yidian","channel_name":"一点号","channel_type_code":"vtt_yidian","channel_type_name":"视频兔兔的一点号应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"f0b531e41f4f11eca4df8bbcc22e30e6","channel_code":"yidian","channel_type_code":"vtt_yidian","name":"打工人1号","avatar":"http://head-img.videototo.com/Fpo_0phXgaUEMV5rxcB6LDw-bxb2","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632718878,"is_pub_able":1,"is_pub_message":"","channel_name":"一点号","channel_type_name":"视频兔兔的一点号应用","channel_app_name":"打工人1号"}]},{"channel_code":"bilibili","channel_name":"哔哩哔哩","channel_type_code":"vtt_bilibili","channel_type_name":"视频兔兔的哔哩哔哩应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"202cf6cc1f4711ecacc51ebe835c0f9a","channel_code":"bilibili","channel_type_code":"vtt_bilibili","name":"小燕子_bili","avatar":"http://head-img.videototo.com/FgMEsVrcqD5DidOIkiGgZNHQAbYf","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632715089,"is_pub_able":1,"is_pub_message":"","channel_name":"哔哩哔哩","channel_type_name":"视频兔兔的哔哩哔哩应用","channel_app_name":"小燕子_bili"}]},{"channel_code":"dayu","channel_name":"大鱼号","channel_type_code":"vtt_dayu_pro","channel_type_name":"视频兔兔的大鱼号PRO应用","channel_app_items":[{"group_id":"6c8b55e7387da4799772ddb389f06753","group_name":"省宣传部","uuid":"5e7fd6be1f4311ec92a5417c9aac2b41","channel_code":"dayu","channel_type_code":"vtt_dayu_pro","name":"快乐萌萌","avatar":"http://head-img.videototo.com/Fq5BSc10S9rvn4doFQ--JU8hAeZL","fans_count":0,"source":"scms","source_uuid":"b7498f517f48cab91408685674cabbac","source_product_id":"","source_user_token":"","permission":2,"refreshed_at":"0","status":1,"created_at":1632713490,"is_pub_able":1,"is_pub_message":"","channel_name":"大鱼号","channel_type_name":"视频兔兔的大鱼号PRO应用","channel_app_name":"快乐萌萌"}]}],"_links":{"self":{"href":"http://api.ccp:82/v1/task-group-channel-app-sources?filter%5Bgroup_id%5D=6c8b55e7387da4799772ddb389f06753&filter%5Bchannel_type_code%5D%5Bin%5D%5B0%5D=vtt_douyin&filter%5Bchannel_type_code%5D%5Bin%5D%5B1%5D=vtt_douyin_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B2%5D=vtt_kuaishou&filter%5Bchannel_type_code%5D%5Bin%5D%5B3%5D=vtt_kuaishou_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B4%5D=vtt_baijia&filter%5Bchannel_type_code%5D%5Bin%5D%5B5%5D=vtt_baijia_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B6%5D=vtt_dayu&filter%5Bchannel_type_code%5D%5Bin%5D%5B7%5D=vtt_dayu_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B8%5D=vtt_qq&filter%5Bchannel_type_code%5D%5Bin%5D%5B9%5D=vtt_yidian&filter%5Bchannel_type_code%5D%5Bin%5D%5B10%5D=vtt_qutoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B11%5D=vtt_miaopai&filter%5Bchannel_type_code%5D%5Bin%5D%5B12%5D=vtt_meipai&filter%5Bchannel_type_code%5D%5Bin%5D%5B13%5D=vtt_rrtv&filter%5Bchannel_type_code%5D%5Bin%5D%5B14%5D=vtt_sohutv&filter%5Bchannel_type_code%5D%5Bin%5D%5B15%5D=vtt_sohu&filter%5Bchannel_type_code%5D%5Bin%5D%5B16%5D=vtt_acfun&filter%5Bchannel_type_code%5D%5Bin%5D%5B17%5D=vtt_yinyuetai&filter%5Bchannel_type_code%5D%5Bin%5D%5B18%5D=vtt_neteasemusic&filter%5Bchannel_type_code%5D%5Bin%5D%5B19%5D=vtt_cashtoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B20%5D=vtt_dianping&filter%5Bchannel_type_code%5D%5Bin%5D%5B21%5D=vtt_weibo&filter%5Bchannel_type_code%5D%5Bin%5D%5B22%5D=vtt_sina&filter%5Bchannel_type_code%5D%5Bin%5D%5B23%5D=vtt_iqiyi&filter%5Bchannel_type_code%5D%5Bin%5D%5B24%5D=vtt_toutiao_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B25%5D=vtt_bilibili&filter%5Bchannel_type_code%5D%5Bin%5D%5B26%5D=vtt_netease&filter%5Bchannel_type_code%5D%5Bin%5D%5B27%5D=vtt_sogou&per-page=6&group_id=6c8b55e7387da4799772ddb389f06753&page=1"},"first":{"href":"http://api.ccp:82/v1/task-group-channel-app-sources?filter%5Bgroup_id%5D=6c8b55e7387da4799772ddb389f06753&filter%5Bchannel_type_code%5D%5Bin%5D%5B0%5D=vtt_douyin&filter%5Bchannel_type_code%5D%5Bin%5D%5B1%5D=vtt_douyin_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B2%5D=vtt_kuaishou&filter%5Bchannel_type_code%5D%5Bin%5D%5B3%5D=vtt_kuaishou_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B4%5D=vtt_baijia&filter%5Bchannel_type_code%5D%5Bin%5D%5B5%5D=vtt_baijia_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B6%5D=vtt_dayu&filter%5Bchannel_type_code%5D%5Bin%5D%5B7%5D=vtt_dayu_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B8%5D=vtt_qq&filter%5Bchannel_type_code%5D%5Bin%5D%5B9%5D=vtt_yidian&filter%5Bchannel_type_code%5D%5Bin%5D%5B10%5D=vtt_qutoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B11%5D=vtt_miaopai&filter%5Bchannel_type_code%5D%5Bin%5D%5B12%5D=vtt_meipai&filter%5Bchannel_type_code%5D%5Bin%5D%5B13%5D=vtt_rrtv&filter%5Bchannel_type_code%5D%5Bin%5D%5B14%5D=vtt_sohutv&filter%5Bchannel_type_code%5D%5Bin%5D%5B15%5D=vtt_sohu&filter%5Bchannel_type_code%5D%5Bin%5D%5B16%5D=vtt_acfun&filter%5Bchannel_type_code%5D%5Bin%5D%5B17%5D=vtt_yinyuetai&filter%5Bchannel_type_code%5D%5Bin%5D%5B18%5D=vtt_neteasemusic&filter%5Bchannel_type_code%5D%5Bin%5D%5B19%5D=vtt_cashtoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B20%5D=vtt_dianping&filter%5Bchannel_type_code%5D%5Bin%5D%5B21%5D=vtt_weibo&filter%5Bchannel_type_code%5D%5Bin%5D%5B22%5D=vtt_sina&filter%5Bchannel_type_code%5D%5Bin%5D%5B23%5D=vtt_iqiyi&filter%5Bchannel_type_code%5D%5Bin%5D%5B24%5D=vtt_toutiao_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B25%5D=vtt_bilibili&filter%5Bchannel_type_code%5D%5Bin%5D%5B26%5D=vtt_netease&filter%5Bchannel_type_code%5D%5Bin%5D%5B27%5D=vtt_sogou&per-page=6&group_id=6c8b55e7387da4799772ddb389f06753&page=1"},"last":{"href":"http://api.ccp:82/v1/task-group-channel-app-sources?filter%5Bgroup_id%5D=6c8b55e7387da4799772ddb389f06753&filter%5Bchannel_type_code%5D%5Bin%5D%5B0%5D=vtt_douyin&filter%5Bchannel_type_code%5D%5Bin%5D%5B1%5D=vtt_douyin_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B2%5D=vtt_kuaishou&filter%5Bchannel_type_code%5D%5Bin%5D%5B3%5D=vtt_kuaishou_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B4%5D=vtt_baijia&filter%5Bchannel_type_code%5D%5Bin%5D%5B5%5D=vtt_baijia_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B6%5D=vtt_dayu&filter%5Bchannel_type_code%5D%5Bin%5D%5B7%5D=vtt_dayu_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B8%5D=vtt_qq&filter%5Bchannel_type_code%5D%5Bin%5D%5B9%5D=vtt_yidian&filter%5Bchannel_type_code%5D%5Bin%5D%5B10%5D=vtt_qutoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B11%5D=vtt_miaopai&filter%5Bchannel_type_code%5D%5Bin%5D%5B12%5D=vtt_meipai&filter%5Bchannel_type_code%5D%5Bin%5D%5B13%5D=vtt_rrtv&filter%5Bchannel_type_code%5D%5Bin%5D%5B14%5D=vtt_sohutv&filter%5Bchannel_type_code%5D%5Bin%5D%5B15%5D=vtt_sohu&filter%5Bchannel_type_code%5D%5Bin%5D%5B16%5D=vtt_acfun&filter%5Bchannel_type_code%5D%5Bin%5D%5B17%5D=vtt_yinyuetai&filter%5Bchannel_type_code%5D%5Bin%5D%5B18%5D=vtt_neteasemusic&filter%5Bchannel_type_code%5D%5Bin%5D%5B19%5D=vtt_cashtoutiao&filter%5Bchannel_type_code%5D%5Bin%5D%5B20%5D=vtt_dianping&filter%5Bchannel_type_code%5D%5Bin%5D%5B21%5D=vtt_weibo&filter%5Bchannel_type_code%5D%5Bin%5D%5B22%5D=vtt_sina&filter%5Bchannel_type_code%5D%5Bin%5D%5B23%5D=vtt_iqiyi&filter%5Bchannel_type_code%5D%5Bin%5D%5B24%5D=vtt_toutiao_pro&filter%5Bchannel_type_code%5D%5Bin%5D%5B25%5D=vtt_bilibili&filter%5Bchannel_type_code%5D%5Bin%5D%5B26%5D=vtt_netease&filter%5Bchannel_type_code%5D%5Bin%5D%5B27%5D=vtt_sogou&per-page=6&group_id=6c8b55e7387da4799772ddb389f06753&page=1"}},"_meta":{"totalCount":6,"pageCount":1,"currentPage":1,"perPage":6}}}[root@api-console-migrate-6fc4566467-qbfch /]# 

7、一直减少至 18 个参数后,就能够正常响应 200。总计为 918 个字符数。虽然官方 RFC 2616 没有指定限制,但许多安全协议和建议都规定服务器上的 maxQueryStrings 应设置为最大字符数限制 1024。而整个 URL,包括查询字符串,应设置为最大 2048 。

{{host_info}}{{base_url}}/v{{module}}/task-group-channel-app-sources?filter[group_id]={{group_id}}&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&per-page=100&group_id={{group_id}}

8、查看 Kong 的 tcp log。upstream sent too big header while reading response header from upstream。如图6

查看 Kong 的 tcp log。upstream sent too big header while reading response header from upstream。

图6

2021/09/30 09:10:12 [error] 65#0: *8025344 upstream sent too big header while reading response header from upstream, client: 10.42.0.231, server: kong, request: "GET /ccpapi/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753 HTTP/1.1", upstream: "http://10.103.175.193:82/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][ 
15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753", host: "api.webtest.chinamcloud.cn" 
10.42.0.231 - - [30/Sep/2021:09:10:12 +0000] "GET /ccpapi/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753 HTTP/1.1" 502 75 "-" "PostmanRuntime/7.28.4" 

9、在 kong 容器中添加环境变量。KONG_NGINX_PROXY_PROXY_BUFFER_SIZE、KONG_NGINX_PROXY_PROXY_BUFFERS。如图7

在 kong 容器中添加环境变量。KONG_NGINX_PROXY_PROXY_BUFFER_SIZE、KONG_NGINX_PROXY_PROXY_BUFFERS。

图7

KONG_NGINX_PROXY_PROXY_BUFFER_SIZE=160k
KONG_NGINX_PROXY_PROXY_BUFFERS=64 160k

10、再次请求,仍然响应 502,只不过响应体发生了变化,响应 HTML 。如图8

再次请求,仍然响应 502,只不过响应体发生了变化,响应 HTML 。

图8

<html>

<head>
	<title>502 Bad Gateway</title>
</head>

<body>
	<center>
		<h1>502 Bad Gateway</h1>
	</center>
	<hr>
	<center>nginx/1.17.10</center>
</body>

</html>

11、查看 Kong 的 tcp log。未再报错。如图9

查看 Kong 的 tcp log。未再报错。

图9

10.42.0.231 - - [30/Sep/2021:10:34:36 +0000] "GET /ccpapi/v1/task-group-channel-app-sources?filter[group_id]=6c8b55e7387da4799772ddb389f06753&filter[channel_type_code][in][0]=vtt_douyin&filter[channel_type_code][in][1]=vtt_douyin_pro&filter[channel_type_code][in][2]=vtt_kuaishou&filter[channel_type_code][in][3]=vtt_kuaishou_pro&filter[channel_type_code][in][4]=vtt_baijia&filter[channel_type_code][in][5]=vtt_baijia_pro&filter[channel_type_code][in][6]=vtt_dayu&filter[channel_type_code][in][7]=vtt_dayu_pro&filter[channel_type_code][in][8]=vtt_qq&filter[channel_type_code][in][9]=vtt_yidian&filter[channel_type_code][in][10]=vtt_qutoutiao&filter[channel_type_code][in][11]=vtt_miaopai&filter[channel_type_code][in][12]=vtt_meipai&filter[channel_type_code][in][13]=vtt_rrtv&filter[channel_type_code][in][14]=vtt_sohutv&filter[channel_type_code][in][15]=vtt_sohu&filter[channel_type_code][in][16]=vtt_acfun&filter[channel_type_code][in][17]=vtt_yinyuetai&filter[channel_type_code][in][18]=vtt_neteasemusic&per-page=100&group_id=6c8b55e7387da4799772ddb389f06753 HTTP/1.1" 200 0 "-" "PostmanRuntime/7.28.4" 

12、参考网址:https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#proxy-buffers-number 。在 Rancher 中,查找到 kong 容器所对应的负载均衡,编辑 YAML 文件。添加 2 行 nginx.ingress 相关配置项。如图10

参考网址:https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#proxy-buffers-number 。在 Rancher 中,查找到 kong 容器所对应的负载均衡,编辑 YAML 文件。添加 2 行 nginx.ingress 相关配置项。

图10

    nginx.ingress.kubernetes.io/proxy-buffer-size: 160k
    nginx.ingress.kubernetes.io/proxy-buffers-number: "64"

13、再次请求,响应 200,符合预期。如图11

再次请求,响应 200,符合预期。

图11

原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/tech/webdev/181719.html

(0)
上一篇 2021年11月1日 08:29
下一篇 2021年11月1日 08:42

相关推荐

发表回复

登录后才能评论