FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Cannot redirect to authorize page when fusionauth and front end app dockerized

    Scheduled Pinned Locked Moved Unsolved
    Q&A
    2
    8
    1.9k
    Loading More Posts
    • 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.
    • R
      ronn316
      last edited by ronn316

      I have run into an issue which I am not sure how to solve.

      Following the .NET sample application, the docker-compose file is containerising the fusionauth instance and the database, while the .NET application is not dockerized.

      The appsettings.json sets the Authority to http://localhost:9011 and all works fine.

      But if you dockerize the .NET application as well, and include it in the same docker-compose file then there will be an issue with the login and logout functionality, because the Authority http://localhost:9011 will not be accessible.

      alt text

      This is understandable because to let your containers speak to each other you need to use the container name set in the dockercompose. So if I change the Authority to http://fusionauth:9011 (my FusionAuth service in the dockercompose is named fusionauth), then when clicking login on the app you will see this.

      alt text

      So it cannot resolve the path for some reason. The odd thing is by manually updating the url from that image above to the below, it will work.

      alt text

      But this only works when inputting the localhost manually and not when setting the Authority in the appsettings.json.

      mark.robustelliM 1 Reply Last reply Reply Quote 0
      • mark.robustelliM
        mark.robustelli @ronn316
        last edited by

        @ronn316 said in Cannot redirect to authorize page when fusionauth and front end app dockerized:

        But if you dockerize the .NET application as well

        Do you mean run the .Net application in the same docker image as the FusionAuth applicaiton? If so, the application was not designed to run in this configuration. That is not to say it is not possible, it will likely just take a little extra configuration.

        R 1 Reply Last reply Reply Quote 0
        • R
          ronn316 @mark.robustelli
          last edited by

          @mark-robustelli not exactly, it's dockerized but in its own container. So fusionauth is running in one container and the .Net app in another. They're both in the same docker-compose though.

          mark.robustelliM 1 Reply Last reply Reply Quote 0
          • mark.robustelliM
            mark.robustelli @ronn316
            last edited by

            @ronn316 Ok. That makes sense. So we can have a baseline, can you get the application to run as designed? Meaning running the code on the local machine and having the FusionAuth application run in docker?

            R 1 Reply Last reply Reply Quote 0
            • R
              ronn316 @mark.robustelli
              last edited by

              @mark-robustelli yes it works just fine this way.

              mark.robustelliM 1 Reply Last reply Reply Quote 0
              • mark.robustelliM
                mark.robustelli @ronn316
                last edited by mark.robustelli

                @ronn316 Ok, so this looks like an issue with the "dockerized" .Net app not being able to see the "dockerized" FusionAuth app. It sounds like a configuration issue with docker. If you ping the fusionauth url from the .Net app container, it will likely returned not found. You will need to figure out how to get that to resolve to the IP of the FusionAuth app container. Once you figure that out, I would think it would work. Unfortunately, I'm not familiar enough with docker network to figure that out. Hopefully, someone else can chime in.

                R 1 Reply Last reply Reply Quote 0
                • R
                  ronn316 @mark.robustelli
                  last edited by

                  @mark-robustelli I came across a solution online. Changing the Authority in the webapp appsettings to the local machine IP address seemed to fix it.

                  "Authority": "http://10.1.20.69:9011",
                  

                  I'm not sure I like this approach because my local IP probably isn't static. I would much rather localhost:9011 or fusionauth:9011 to work, but I don't understand networking enough to understand why they don't.

                  Anyway this issue will only be occurring in development so I can deal with it. In production each app will be hosted separately so using the public domain name as the authority should work.

                  mark.robustelliM 1 Reply Last reply Reply Quote 0
                  • mark.robustelliM
                    mark.robustelli @ronn316
                    last edited by

                    @ronn316 Awesome glad to see you got it working. I'm sure there is a way to use a dns name, but like I mentioned before, someone with a little more docker experience would have to help us out here. Thanks for working this through and sharing with the community.

                    1 Reply Last reply Reply Quote 0
                    • R ronn316 referenced this topic on
                    • First post
                      Last post