Accessing a web server with not trusted or expired Portal for ArcGIS and/or ArcGIS Server self-signed certificates returns the following error, even if the web server certificate is valid.
Error: Error: 502 Web server received an invalid response while acting as a gateway or proxy server
A certificate is a digital file that contains information about the identity of the web server. It also contains the encryption technique to use when establishing a secure channel between the web server and the organization. See: Enable HTTPS on your web server
Despite a valid Secure Sockets Layer (SSL) certificate on the web server, the error is returned because the Portal for ArcGIS and ArcGIS Server self-signed certificates have expired.
Note: There are no web adaptors in an Azure Web Geographical Information Systems Cloud Builder deployment. Instead, a URL Rewrite is used, redirecting from a web server URL to HTTPS port 7443 for Portal for ArcGIS, and HTTPS port 6443 for ArcGIS Server.