Hi @Mohamed Roushdy ,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.
Issue:
You were trying to publish an internal application. Your environment had two Azure ProxyApp connector machines, one NDES app server, a proxy app that using a different external URL from the internal URL, and a custom domain with the SSL certificate uploaded. The app worked when the App Proxy was configured to use HTTP, but when switching to HTTPs, you received a "bad gateway" error. You were able to reach HTTPs from both machines via web browsers, but received insecure website certificate errors since the machines were not joined to the domain.
Solution:
Manually importing the Certificate Authority chain resolved the issue. Since the connector machine was not joined to the domain, the CA needed to be imported so that the website's internal CA would be detected as secure. The app proxy issue is now resolved.
If you have any other questions or are running into more errors or certificate issues, please let me know.
Thank you again for your time and patience throughout this issue.
-
Please remember to "Accept the answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.