Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. 502 Error on some websites

502 Error on some websites

Scheduled Pinned Locked Moved Solved Support
app proxy
13 Posts 3 Posters 2.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nebulonN Offline
    nebulonN Offline
    nebulon
    Staff
    wrote on last edited by
    #3

    Seems like nginx being the proxy here on Cloudron side, tries to access the origin by IP after resolving and since that page is behind a cloudflare proxy, which does not allow direct IP access, it fails with this error message:

    2023/11/28 19:12:38 [error] 419125#419125: *65780 SSL_do_handshake() failed (SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40) while SSL handshaking to upstream, client: 2a02:810d:c0:9ef1:372a:20b8:38ac:ffa3, server: foo.nebulon.space, request: "GET / HTTP/2.0", upstream: "https://104.21.0.239:443/", host: "foo.nebulon.space"
    

    Not yet sure how to solve this correctly.

    1 Reply Last reply
    0
    • robiR Offline
      robiR Offline
      robi
      wrote on last edited by
      #4

      Yes, interesting!

      There should be a way to make nginx either allow remote proxying, separating the cert from the IP, or stop checking for the page by IP since only the domain can deliver the page data.

      Conscious tech

      1 Reply Last reply
      0
      • nebulonN Offline
        nebulonN Offline
        nebulon
        Staff
        wrote on last edited by
        #5

        Still investigating, but to take a step back, is this just a random test or an actual use-case to put Cloudron in front of a public page served up by Cloudflare?

        1 Reply Last reply
        0
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #6

          I think this behavior is expected. When designing the App Proxy we had to decide what use case it is for. It is designed to front apps with a certificate and subdomain managed by Cloudron. We have thus configured nginx to set the Host header to the Cloudron App Proxy name (i.e downloader.demo.cloudron.io) when making the proxy request. The target/destination (since this is an app that is in the control of the admin trying to front the app) has to be configured accordingly.

          In this case, trying to mirror a 3rd party website is not going to work. The 3rd party site will see that the request is intended for downloader.demo.cloudron.io and the TLS SNI verification will fail.

          1 Reply Last reply
          1
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #7

            I remember researching this topic about mirroring back then. See https://github.com/NginxProxyManager/nginx-proxy-manager/issues/127#issuecomment-485977281 and especially https://github.com/NginxProxyManager/nginx-proxy-manager/issues/127#issuecomment-485986744 . We tried to mimic nginx proxy manager as the default behavior.

            Some more recent discussion here - https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2675 . There's actually many issues there on this very topic 🙂

            1 Reply Last reply
            0
            • robiR Offline
              robiR Offline
              robi
              wrote on last edited by
              #8

              @nebulon random.

              @girish would it be best to serve a custom error message to that effect? Reveal the mystery, so to speak.

              Conscious tech

              1 Reply Last reply
              0
              • girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #9

                I remember trying to play around with this long ago. Issue was some apps respond with 502 and an error page. We want the error page to pass through in that case. I didn't find a way to distinguish "cannot contact upstream" vs "upstream caused 502" and give different error pages.

                robiR 1 Reply Last reply
                0
                • girishG girish

                  I remember trying to play around with this long ago. Issue was some apps respond with 502 and an error page. We want the error page to pass through in that case. I didn't find a way to distinguish "cannot contact upstream" vs "upstream caused 502" and give different error pages.

                  robiR Offline
                  robiR Offline
                  robi
                  wrote on last edited by
                  #10

                  @girish ok, then it stays as it is. Add a note in the docs?

                  Conscious tech

                  1 Reply Last reply
                  0
                  • nebulonN Offline
                    nebulonN Offline
                    nebulon
                    Staff
                    wrote on last edited by
                    #11

                    @robi just for my understanding, did you have a specific use-case for this or was it more like a test?

                    robiR 1 Reply Last reply
                    0
                    • girishG Offline
                      girishG Offline
                      girish
                      Staff
                      wrote on last edited by
                      #12

                      Added a note in docs.

                      1 Reply Last reply
                      1
                      • girishG girish has marked this topic as solved on
                      • nebulonN nebulon

                        @robi just for my understanding, did you have a specific use-case for this or was it more like a test?

                        robiR Offline
                        robiR Offline
                        robi
                        wrote on last edited by
                        #13

                        @nebulon test, as in previous testing proxying across cloudrons, and to other search engines worked just fine, and these tools sites, didn't.

                        Conscious tech

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Bookmarks
                        • Search