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. App Packaging & Development
  3. Multi-Domain setup in one app

Multi-Domain setup in one app

Scheduled Pinned Locked Moved App Packaging & Development
10 Posts 3 Posters 424 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.
  • E Offline
    E Offline
    ekevu123
    wrote on last edited by ekevu123
    #1

    Using Phoenix Elixir, I want to build one monorepo app that hosts mini-apps with shared code base that should be reachable under different domains.

    I have set up my reverse proxy and tested it. On Cloudron, I have set one app as the main domain and the other one as alias. In the cloudron manifest, I have set

        "multiDomain": true,
    

    To debug whether the issue is with Cloudron or my proxy setup, I have run this in the app container:

    curl -v -H "Host: Domain1" http://localhost:4000/
    

    and respectively with the other domain. 4000 is the port of the proxy inside my app. Both responses resolve the correct site, so I am assuming that my proxy setup works.

    Yet the issue is that Cloudron resolves only the main domain. When I access domain2, I am forwarded to domain1 and my app's logs indicate someone had tried to access domain1.

    How can I debug this?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joseph
      Staff
      wrote on last edited by
      #2

      you can inspect the generated reverse proxy config in /etc/nginx/applications/appid/ .

      1 Reply Last reply
      0
      • J joseph moved this topic from Support on
      • robiR Offline
        robiR Offline
        robi
        wrote on last edited by
        #3

        How did you define domain2 in the manifest?

        Conscious tech

        E 1 Reply Last reply
        0
        • robiR robi

          How did you define domain2 in the manifest?

          E Offline
          E Offline
          ekevu123
          wrote on last edited by
          #4

          @robi said in Multi-Domain setup in one app:

          How did you define domain2 in the manifest?

          I don't think this is possible based on the manifest documentation. I can only set multidomain to true, and then define an alias later.

          @joseph said in Multi-Domain setup in one app:

          you can inspect the generated reverse proxy config in /etc/nginx/applications/appid/ .

          Thank you, I am working through it right now!

          1 Reply Last reply
          0
          • E Offline
            E Offline
            ekevu123
            wrote on last edited by
            #5

            Okay, I found the issue. The problem was that for testing purposes, domain2 was a subdomain of domain1. So, all calls made to domain2 where resolved to domain1 - however, not by my app, but by cloudron. When I connected a top-level domain to Cloudron and changed it in my app's settings, the app resolved correctly both domains.

            However, I wonder if that should be the case. Granted, if you wanted to use a subdomain, you probably wouldn't need the multi-domain setup, but at least for testing, I would have assumed this would work.

            I believe the issue is that Cloudron didn't preserver the original host.

            J 1 Reply Last reply
            1
            • E ekevu123

              Okay, I found the issue. The problem was that for testing purposes, domain2 was a subdomain of domain1. So, all calls made to domain2 where resolved to domain1 - however, not by my app, but by cloudron. When I connected a top-level domain to Cloudron and changed it in my app's settings, the app resolved correctly both domains.

              However, I wonder if that should be the case. Granted, if you wanted to use a subdomain, you probably wouldn't need the multi-domain setup, but at least for testing, I would have assumed this would work.

              I believe the issue is that Cloudron didn't preserver the original host.

              J Offline
              J Offline
              joseph
              Staff
              wrote on last edited by
              #6

              @ekevu123 said in Multi-Domain setup in one app:

              So, all calls made to domain2 where resolved to domain1 - however, not by my app, but by cloudron

              Do you mean, domain1 is like app.example.com and domain2 is like test.app.example.com ? (where example.com was added in the Domains UI ?)

              by resolved, do you mean DNS resolution?

              E 1 Reply Last reply
              0
              • J joseph

                @ekevu123 said in Multi-Domain setup in one app:

                So, all calls made to domain2 where resolved to domain1 - however, not by my app, but by cloudron

                Do you mean, domain1 is like app.example.com and domain2 is like test.app.example.com ? (where example.com was added in the Domains UI ?)

                by resolved, do you mean DNS resolution?

                E Offline
                E Offline
                ekevu123
                wrote on last edited by
                #7

                @joseph said in Multi-Domain setup in one app:

                Do you mean, domain1 is like app.example.com and domain2 is like test.app.example.com ? (where example.com was added in the Domains UI ?)

                Yes, domain 1 was example.com and domain 2 was test.example.com. When I changed app 2 and connected anotherexample.com, it worked, so the issue was with using a subdomain compared to using a different domain - in my opinion, because Cloudron cut this information, so my proxy didn't have a chance to get this right.

                @joseph said in Multi-Domain setup in one app:

                by resolved, do you mean DNS resolution?

                0

                I am referring to the end result, so any traffic to domain2 (subdomain) went to domain1 for whatever reason.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  ekevu123
                  wrote on last edited by
                  #8

                  @joseph Did you have a chance to check this? I understand that the issue isn't a priority, but if the issue really is cloudron-related according to the above, then it would be helpful if this could be fixed eventually.

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    joseph
                    Staff
                    wrote on last edited by
                    #9

                    I can't seem to reproduce it atleast. I setup an app with domain and subdomain (using minio app, which has same setup as yours) and it seems to work . If you can reproduce it with say minio , maybe that will help us narrow it down. Also, which DNS provider are you using (just to rule out any wildcard/manul DNS setup issues) ?

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      ekevu123
                      wrote on last edited by
                      #10

                      Thank you for checking, I really appreciate it! I had one domain with HostEurope and one with Porkbun.
                      I will look into Minio, but since that's a completely new codebase, and I might need to extract additional logs from that to understand the difference, I might not be able to do that.

                      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