Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Trouble making HTTP requests from docker container

    Scheduled Pinned Locked Moved
    Duet Web Control
    5
    20
    583
    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.
    • Peter Lebiedzinskiundefined
      Peter Lebiedzinski
      last edited by

      I have a docker container running on a Windows PC using WSL2 that needs to communicate to a printer running Duet that is connected via WiFi and/or Ethernet.

      From the Windows PC commandline, I am able to make the requests to the required endpoint:

      http://<duet_ip>/rr_status

      However, once inside the docker container, neither the application nor using the console allows me to make the same request. The response received when making the request inside the docker container is:

      """

      HTTP/1.1 404 page not found<br>Check that the SD card is mounted and has the correct files in its /www folder\r\n

      """

      I have tried re-creating the headers from the working HTTP request with no success.

      Is there something I am missing that isn't allowing the requests to work as expected?

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • chrishammundefined
        chrishamm administrators @Peter Lebiedzinski
        last edited by

        @Peter-Lebiedzinski It sounds like the final query URL doesn't start with rr_ as in http://duet3/rr_status. Can you send the full command to make that request?

        Duet software engineer

        Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
        • Peter Lebiedzinskiundefined
          Peter Lebiedzinski @chrishamm
          last edited by Peter Lebiedzinski

          @chrishamm Hypertext Transfer Protocol
          GET http://192.168.75.110/rr_status?type=3 HTTP/1.1\r\n
          [Expert Info (Chat/Sequence): GET http://192.168.75.110/rr_status?type=3 HTTP/1.1\r\n]
          [GET http://192.168.75.110/rr_status?type=3 HTTP/1.1\r\n]
          [Severity level: Chat]
          [Group: Sequence]
          Request Method: GET
          Request URI: http://192.168.75.110/rr_status?type=3
          Request Version: HTTP/1.1
          Host: 192.168.75.110\r\n
          User-Agent: curl/7.74.0\r\n
          Accept: /\r\n
          \r\n
          [Full request URI: http://192.168.75.110/rr_status?type=3]
          [HTTP request 1/1]
          [Response in frame: 4903]

          Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
          • Peter Lebiedzinskiundefined
            Peter Lebiedzinski @Peter Lebiedzinski
            last edited by

            @Peter-Lebiedzinski And the response:

            Hypertext Transfer Protocol
            HTTP/1.1 404 page not found<br>Check that the SD card is mounted and has the correct files in its /www folder\r\n
            [Expert Info (Chat/Sequence): HTTP/1.1 404 page not found<br>Check that the SD card is mounted and has the correct files in its /www folder\r\n]
            [HTTP/1.1 404 page not found<br>Check that the SD card is mounted and has the correct files in its /www folder\r\n]
            [Severity level: Chat]
            [Group: Sequence]
            Response Version: HTTP/1.1
            Status Code: 404
            [Status Code Description: Not Found]
            Response Phrase: page not found<br>Check that the SD card is mounted and has the correct files in its /www folder
            Connection: close\r\n
            \r\n
            [HTTP response 1/1]
            [Time since request: 0.213434000 seconds]
            [Request in frame: 4848]
            [Request URI: http://192.168.75.110/rr_status?type=3]
            File Data: 239 bytes
            Data (239 bytes)

            chrishammundefined 1 Reply Last reply Reply Quote 0
            • chrishammundefined
              chrishamm administrators @Peter Lebiedzinski
              last edited by chrishamm

              @Peter-Lebiedzinski It doesn't sound like the Duet gets an rr_status request, I suspect something alters your request. Even if you send something like rr_foobar (i.e. an unknown command), you get back Your Duet rejected the HTTP request: Unknown request and not 404 page not found.

              You can hook up a USB cable to your Duet, open a serial terminal, and send M111 P2 S1 to enable debugging for the webserver which lets you track incoming requests:

              HTTP connection accepted
              Sending JSON reply, length 736
              HTTP req, command words { GET /rr_status HTTP/1.1 }, parameters { type=3 }
              

              Duet software engineer

              Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
              • Peter Lebiedzinskiundefined
                Peter Lebiedzinski @chrishamm
                last edited by

                @chrishamm I've also been suspecting that something is changing or re-routing the request. Perhaps something in the server configuration. Would you be able to point me to the file locations in the repository for the following (I'm not familiar with Duet):

                • File that handles the HTTP routes

                • Server configuration file (nginx.conf if Duet uses nginx)

                I think this would be a good starting point for me to see what is happening in the background.

                Peter Lebiedzinskiundefined chrishammundefined 2 Replies Last reply Reply Quote 0
                • Peter Lebiedzinskiundefined
                  Peter Lebiedzinski @Peter Lebiedzinski
                  last edited by

                  @Peter-Lebiedzinski @chrishamm Since I don't currently have access to a USB cable with duet until Sunday, and this is time-sensitive for me.

                  1 Reply Last reply Reply Quote 0
                  • chrishammundefined
                    chrishamm administrators @Peter Lebiedzinski
                    last edited by

                    @Peter-Lebiedzinski Since reprapfirmware is using its own little http server there is no dedicate config file. Here you can find some docs about the general API: https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests Note that every request starting with /rr_ is covered there.

                    Every other request is a file request. Probably some subdirectory (like /foobar/rr_status) is added to your request leading to that error. Without further debugging as pointed out above it's hard to say what it is.

                    Maybe you can run Wireshark on the host and capture what exactly is going on.

                    Duet software engineer

                    Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
                    • Peter Lebiedzinskiundefined
                      Peter Lebiedzinski @chrishamm
                      last edited by

                      @chrishamm It looks like the request URI is not resolving properly and this is causing the server to treat it as a file request:

                      https://github.com/Duet3D/RepRapFirmware/blob/v3-chrishamm/src/Networking/HttpResponder.cpp#L1140

                      Wireshark traces:

                      Working request payload:

                      Hypertext Transfer Protocol
                      GET /rr_status HTTP/1.1\r\n
                      Host: 192.168.75.110\r\n
                      User-Agent: curl/7.83.1\r\n
                      Accept: /\r\n
                      \r\n
                      [Full request URI: http://192.168.75.110/rr_status]
                      [HTTP request 1/1]
                      [Response in frame: 9957]

                      Not working request payload:

                      Hypertext Transfer Protocol
                      GET http://192.168.75.110/rr_status HTTP/1.1\r\n
                      Host: 192.168.75.110\r\n
                      User-Agent: curl/7.74.0\r\n
                      Accept: /\r\n
                      \r\n
                      [Full request URI: http://192.168.75.110/rr_status]
                      [HTTP request 1/1]
                      [Response in frame: 23915]

                      chrishammundefined 1 Reply Last reply Reply Quote 0
                      • o_lampeundefined
                        o_lampe
                        last edited by

                        All that HTTP and Docker stuff is way out of my knowledge zone, but I'd try to "ping" the Duet bord from inside the docker container.
                        Maybe Duets IP address is out of Dockers reach?

                        1 Reply Last reply Reply Quote 0
                        • chrishammundefined
                          chrishamm administrators @Peter Lebiedzinski
                          last edited by

                          @Peter-Lebiedzinski Thanks, that explains it, looks like the Duet HTTP server didn't understand absolute URIs. I've got a fix ready, if you are comfortable running out a beta version, here my current dev build for the 6HC with that fix.

                          Duet software engineer

                          Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
                          • Peter Lebiedzinskiundefined
                            Peter Lebiedzinski @chrishamm
                            last edited by

                            @chrishamm Okay I can try the new build. Will it work on the following Duet hardware:

                            Board: Duet 2 WiFi (2WiFi)
                            Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.4 (2022-10-20)
                            Duet WiFi Server Version: 1.27

                            chrishammundefined 1 Reply Last reply Reply Quote 0
                            • chrishammundefined
                              chrishamm administrators @Peter Lebiedzinski
                              last edited by

                              @Peter-Lebiedzinski Sorry, that's for the 6HC, for some reason I thought you were using that. I'll prepare another Duet 2 build when I get home again.

                              Duet software engineer

                              Peter Lebiedzinskiundefined 1 Reply Last reply Reply Quote 0
                              • Peter Lebiedzinskiundefined
                                Peter Lebiedzinski @chrishamm
                                last edited by

                                @chrishamm Great. Thank you for the fast support.

                                chrishammundefined 1 Reply Last reply Reply Quote 0
                                • chrishammundefined
                                  chrishamm administrators @Peter Lebiedzinski
                                  last edited by

                                  @Peter-Lebiedzinski Here you go.

                                  Duet software engineer

                                  Peter Lebiedzinskiundefined 3 Replies Last reply Reply Quote 1
                                  • Peter Lebiedzinskiundefined
                                    Peter Lebiedzinski @chrishamm
                                    last edited by

                                    @chrishamm This new firmware has fixed the issue. Thank you.

                                    1 Reply Last reply Reply Quote 2
                                    • Peter Lebiedzinskiundefined
                                      Peter Lebiedzinski @chrishamm
                                      last edited by

                                      @chrishamm would we be able to generate the firmware for the Duet 3 6XD board as well?

                                      jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                                      • jay_s_ukundefined
                                        jay_s_uk @Peter Lebiedzinski
                                        last edited by jay_s_uk

                                        @Peter-Lebiedzinski the fix should be included in 3.5b3

                                        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                        1 Reply Last reply Reply Quote 1
                                        • Peter Lebiedzinskiundefined
                                          Peter Lebiedzinski @chrishamm
                                          last edited by

                                          @chrishamm Sorry for asking again, but I am working with someone who is unable to use the latest version 3.5b3, and has to use 3.4.5, specifically with the following:

                                          Board: Duet 3 MB6XD (MB6XD)
                                          DSF Version: 3.4.5
                                          Firmware: RepRapFirmware for Duet 3 MB6XD 3.4.5
                                          Duet Web Control 3.4.5

                                          Could you generate the firmware for this configuration? If possible, in the future, I'd like to save you the trouble of generating these files, is there documentation on how I can generate these files myself?

                                          dc42undefined 1 Reply Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators @Peter Lebiedzinski
                                            last edited by

                                            @Peter-Lebiedzinski I've back-ported the fix to the 3.4-dev branch, so it will be included in the forthcoming 3.4.6 release.

                                            Duet WiFi hardware designer and firmware engineer
                                            Please do not ask me for Duet support via PM or email, use the forum
                                            http://www.escher3d.com, https://miscsolutions.wordpress.com

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA