Navigation

    Hedgehack community

    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    When trying to get the status of a caster using the API, I get a response 403 Forbidden

    YCCaster
    2
    8
    580
    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.
    • dmytro.hryn
      dmytro.hryn last edited by

      Hi, I've run the caster locally in docker using a dockerfile to build the image:

      FROM ubuntu:22.04 as builder
      
      # Install dependencies
      RUN apt-get update && apt-get install build-essential nano --assume-yes
      
      RUN useradd caster
      
      # Set the working directory
      WORKDIR /var/caster
      
      # Get the binary file and move it to the caster directory
      ADD yccaster-amd64 /var/caster/yccaster
      
      # Give execute permission to the binary file
      RUN chmod +x /var/caster/yccaster
      
      # Generate configuration file
      RUN /var/caster/yccaster init
      
      # Create session.log file for save events
      RUN touch /var/caster/session.log
      
      # Create session.log file for save logs
      RUN touch /var/log/caster.log
      
      # NTRIP caster
      EXPOSE 2101
      # api interface
      EXPOSE 8080
      
      EXPOSE 80
      
      # Start the caster
      CMD ["/var/caster/yccaster"]
      

      when running the image, I assign port 8080 for API and 2101 for caster:
      612e5035-7f61-4104-ab5c-13c3ade8f78a-image.png

      then I add an API token for authorized requests
      8d17920a-7009-4c6a-a775-2204336ae5c2-image.png

      when requesting /health that does not require authorization, I get a status 200 response with an empty body
      db68b198-b0c7-49bb-89d6-c8e8f2d3a829-image.png

      but when I try to request /status or other requests requiring authorization with a token, I constantly get a response with status 403 Forbidden
      71a8a347-a6d5-4d7e-967b-c762a2653e51-image.png
      In fact, I run the caster in the GCP cloud in the kubernetes infrastructure, but I get the same error there, after which I tried to understand what the problem is locally. Maybe you can help me, thanks in advance!

      ilyavialkov 1 Reply Last reply Reply Quote 0
      • dmytro.hryn
        dmytro.hryn last edited by

        I want to add that at the same time the caster itself works, I publish the antenna data and receive them by the client.

        1 Reply Last reply Reply Quote 0
        • ilyavialkov
          ilyavialkov @dmytro.hryn last edited by ilyavialkov

          @dmytro-hryn Well done!
          Please use the latest version of the caster

          1 Reply Last reply Reply Quote 0
          • dmytro.hryn
            dmytro.hryn last edited by

            Hi @ilyavialkov, thanks i downloaded the latest version of the caster 1.0.6 but still can't use the api 😬 now i am getting error

            "GET http://localhost:8080/health
            Error: socket hang up"
            ead4f828-4ef7-429d-a8f6-b194542f1169-image.png

            ilyavialkov 1 Reply Last reply Reply Quote 0
            • ilyavialkov
              ilyavialkov @dmytro.hryn last edited by

              @dmytro-hryn ok, I'll check it in a few days and get back to you

              dmytro.hryn 1 Reply Last reply Reply Quote 1
              • dmytro.hryn
                dmytro.hryn @ilyavialkov last edited by

                Hello @ilyavialkov, I was able to use the API locally, the address must be written in the configuration file like:
                43afc1d7-ce4e-4807-905b-d885aa43bd48-image.png
                if write "localhost" or "127.0.0.1" does not work.

                I will try to set up the API in GCP kubernetes, at the moment I am getting an error:
                b856e1f6-b789-4e4d-ba5b-3a13c3dac72d-image.png

                maybe Load Balancing is not configured correctly.
                I'll let you know when I'm done.

                ilyavialkov 1 Reply Last reply Reply Quote 0
                • ilyavialkov
                  ilyavialkov @dmytro.hryn last edited by

                  @dmytro-hryn said in When trying to get the status of a caster using the API, I get a response 403 Forbidden:

                  to use the API locally, the address

                  Cool. Thank you for the investigation. Did not try it in Kub.
                  I'm very intriguing on your project. Can you share what are you building?

                  dmytro.hryn 1 Reply Last reply Reply Quote 0
                  • dmytro.hryn
                    dmytro.hryn @ilyavialkov last edited by

                    @ilyavialkov i'm working on a project for a european company that makes robots that cut grass, initially we use caster BKG as a base but faced some problems with its operation and lack of necessary support. And now we are looking for an alternative, if everything suits us, we will buy a license and cooperate.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Powered by NodeBB | Contributors