Help debugging 502 intermittent error in proxy redirect

Site: pre-learning-noobe
Site ID: 4c323452-8180-4a9d-9834-82ffe9db17b1

We have just redirected the API calls in our preproduction site in order to avoid CORS preflights. So we have added this to our netlify.toml file:

[[redirects]]
from = "/pre-api/*"
to = "https://pre-api.noobe.es/:splat"
status = 200
force = true

Everything is working fine, but we get intermittent 502 errors when calling the API. It happens a lot more in the first calls (with a cold browser) and it may happen in any path.

The simplest call is: https://pre-api.noobe.es/ping (no parameters, no authentication needed) that, when redirected, becomes https://pre-learning.noobe.es/pre-api/ping.

These are the response headers we got when calling the API directly:

< HTTP/2 200 
< cache-control: no-store, must-revalidate, no-cache
< content-length: 27
< content-type: application/json
< expires: 0
< server: Apache
< x-powered-by: PHP/7.4.26
< date: Thu, 19 May 2022 12:52:15 GMT

These when calling through the proxy and the response is ok:

< HTTP/2 200 
< age: 0
< cache-control: no-store, must-revalidate, no-cache
< content-type: application/json
< date: Thu, 19 May 2022 12:47:13 GMT
< expires: 0
< server: Netlify
< x-nf-request-id: 01G3E5Q7CJGQ7A6JVF44F5H2NM
< x-powered-by: PHP/7.4.26
< content-length: 27

And these when calling through the proxy and we get error 502:

< HTTP/2 502 
< age: 2
< content-type: text/html
< date: Thu, 19 May 2022 12:48:24 GMT
< server: Netlify
< x-nf-request-id: 01G3E5SD7PYYHE1RTGEVWV04M3
< content-length: 1477

With an HTML response:

502 - Web server received an invalid response while acting as a gateway or proxy server.

### There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

Any ideas? We have read all about 502 errors in this forum but nothing seems to fit our case.

Thanks in advance.

Hey @Manuel_Llorens,

This is strange because we don’t see any error logged for that request ID in our logs. This usually means that the error came from the proxied destination which we simply relayed backed to the client.

Assuming that it’s not your destination causing the issues, do you have any more request IDs with the issue? I tried triggering it multiple times, but got a 200 consistently.

Are you able to check any logs on the destination? Maybe it indeed sent an error?

Hi, hrishikesh:

Thanks for your response!

I have been seeing the same error one hour ago, and the apache logs in destination have shown no error for those requests.

At this moment I am not able to reply the error neither. But, unless you have changed something in your end, I don’t think it is fixed yet.

I will post more information as soon as I get the same errors again.

I have caught one single 502 error in the last hour.

These is the screenshot of the Chrome console (in anonymous mode):

And those are the Apache logs for those requests (and one from Better Uptime Bot):

[
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:06+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":145,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:16+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":146,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:26+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":148,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:36+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":118,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:46+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":171,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:49+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Better Uptime Bot Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/74.0.3729.169 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"982\",\"CIp\":\"45.33.100.21\",\"SPort\":\"80\",\"Referer\":\"-\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":199,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:34:56+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":167,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:35:06+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":130,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:35:16+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":137,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:35:26+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1876\",\"CIp\":\"206.189.58.26\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":139,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:36:19+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1879\",\"CIp\":\"167.99.246.105\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":189,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:36:25+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1879\",\"CIp\":\"167.99.246.105\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":148,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:36:35+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1879\",\"CIp\":\"167.99.246.105\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":143,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:36:45+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1879\",\"CIp\":\"167.99.246.105\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":141,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  },
  {
    "category": "AppServiceHTTPLogs",
    "time": "2022-05-23T09:36:55+00:00",
    "resourceId": "/SUBSCRIPTIONS/77717527-2E41-455C-9D5B-3A40CA3603E2/RESOURCEGROUPS/NOOBE/PROVIDERS/MICROSOFT.WEB/SITES/API-NOOBE-PRE",
    "properties": "{\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/101.0.0.0 Safari\\/537.36\",\"Cookie\":\"--\",\"ScStatus\":\"200\",\"CsUsername\":\"-\",\"Result\":\"Success\",\"CsHost\":\"pre-api.noobe.es\",\"CsMethod\":\"GET\",\"CsBytes\":\"1879\",\"CIp\":\"167.99.246.105\",\"SPort\":\"80\",\"Referer\":\"https:\\/\\/pre-learning.noobe.es\\/itinerarios\",\"CsUriStem\":\"\\/ping\",\"TimeTaken\":121,\"ScBytes\":\"265\",\"ComputerName\":\"pl1sdlwk000D8A\"}",
    "EventStampType": "Stamp",
    "EventPrimaryStampName": "waws-prod-am2-361",
    "EventStampName": "waws-prod-am2-361",
    "Host": "pl1sdlwk000D8A",
    "EventIpAddress": "10.61.0.29"
  }
]

As you can see, our server is responding with 200 to all requests, but still one of the proxied results fails with 503.

It seems to be happening a lot less than other days, but we are not confident to push this configuration to production.

Thanks in advance.

Some more info:

It seems to fail the first call whenever the remote address changes.

And again, one single fail after the IP changed:

And the logs from our server:

[
  {
    "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36",
    "Cookie": "--",
    "ScStatus": "200",
    "CsUsername": "-",
    "Result": "Success",
    "CsHost": "pre-api.noobe.es",
    "CsMethod": "GET",
    "CsBytes": "1894",
    "CIp": "3.67.255.218",
    "SPort": "80",
    "Referer": "https://pre-learning.noobe.es/itinerarios?nocache=1653299352159",
    "CsUriStem": "/ping",
    "TimeTaken": 142,
    "ScBytes": "265",
    "ComputerName": "pl1sdlwk000D8A"
  },
  {
    "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36",
    "Cookie": "--",
    "ScStatus": "200",
    "CsUsername": "-",
    "Result": "Success",
    "CsHost": "pre-api.noobe.es",
    "CsMethod": "GET",
    "CsBytes": "1894",
    "CIp": "3.67.255.218",
    "SPort": "80",
    "Referer": "https://pre-learning.noobe.es/itinerarios?nocache=1653299352159",
    "CsUriStem": "/ping",
    "TimeTaken": 186,
    "ScBytes": "265",
    "ComputerName": "pl1sdlwk000D8A"
  },
  {
    "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36",
    "Cookie": "--",
    "ScStatus": "200",
    "CsUsername": "-",
    "Result": "Success",
    "CsHost": "pre-api.noobe.es",
    "CsMethod": "GET",
    "CsBytes": "1898",
    "CIp": "161.35.218.92",
    "SPort": "80",
    "Referer": "https://pre-learning.noobe.es/itinerarios?nocache=1653299352159",
    "CsUriStem": "/ping",
    "TimeTaken": 113,
    "ScBytes": "265",
    "ComputerName": "pl1sdlwk000D8A"
  },
  {
    "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36",
    "Cookie": "--",
    "ScStatus": "200",
    "CsUsername": "-",
    "Result": "Success",
    "CsHost": "pre-api.noobe.es",
    "CsMethod": "GET",
    "CsBytes": "1898",
    "CIp": "161.35.218.92",
    "SPort": "80",
    "Referer": "https://pre-learning.noobe.es/itinerarios?nocache=1653299352159",
    "CsUriStem": "/ping",
    "TimeTaken": 169,
    "ScBytes": "265",
    "ComputerName": "pl1sdlwk000D8A"
  }
]

Does this make any sense to you?

Hey there, @Manuel_Llorens :wave:

Thanks for the additional information here. Our logs seem to indicate that your server is returning a 502 error, which perhaps is not being logged. Is it possible that your server wouldn’t log if the error?

Additionally, the IP address will change and is expected to change periodically if you have your DNS configured correctly. This is by design on our side, and is expected.

Hi, Hillary:

As fas as we can see, when the request fails with 502 error we are getting no log for it (nor 502 status code, nor 200), it looks like it is not reaching our server, so it may be a network problem. Our server is hosted in an Azure Wep App but the DNS servers are at Netlify. Could it be a problem?

On the other hand, I do understand that the IP address must change, but I still wonder if there is anything different when it happens, as it is failing almost only and almost always in that case. Maybe there are different request headers in that case or something different with DNS resolution (as it is the first one from that IP)?

I think we have make some progress. This error does not happen if the body of the request is not empty (sending it via cURL, for example), unfortunately, the browser does not allow sending a body for GET and DELETE requests.

I have read that some proxies are adding “Transfer-Encoding: chunked” header to the request, but, as the browser is sending an empty body for those GET requests and no “Content-Length” is present, the Apache web server waits for the body content, generating a 502 error after timeout (HTTP GET with Transfer-Encoding Chunked - Stack Overflow).

May this be the case here? Any ideas about how to fix it?

In our end, the only fix I can imaging is replacing all GET and DELETE requests with POST ones, but that is not an option.

Hey @Manuel_Llorens,

We are still not seeing any error for those requests in our logs, so this could still mean that the error might be coming from the Azure side of things.

However, just to be sure that we’re not missing the logging of any errors, we’ve escalated it to the engineers to confirm.

Hey @Manuel_Llorens,

The engineers have confirmed that the fact that we don’t see any error message in our logs mean that the proxy worked as intended and simply passed on whatever it received. This would mean that the source of error is Azure in this case.

Hi,

Thanks for confirming the error is being produced by our Apache server in Azure.

That said, may it be possible to fix it with an adjustment in Netlify proxy configuration or that is out of the question?

Hi @Manuel_Llorens,

There unfortunately isn’t a way to resolve this on Netlify’s side that would still accomplish the same behavior. Let us know if you have any other questions or concerns and we’d be happy to help however we can.