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

HTTP Endpoint and Cross-Origin Site

Scheduled Pinned Locked Moved
General Discussion
3
6
199
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.
  • undefined
    JRCL
    last edited by 18 Apr 2024, 17:52

    Hello,

    I'm continuing to work on a web app that can upload .gcode files to my machine. However, I've been unable to connect with my machine through HTTP requests. What is the correct formatting for an endpoint for this API? I currently have it like so:

    http://xxx.xxx.x.xx/api/files/gcodes but didn't have too much confidence in that.

    Additionally, I noticed M586 has a C variable for setting the site of cross-origin HTTP requests. Can I use this to set it to that exact same endpoint or how is the C variable effectively used in this case?

    undefined 1 Reply Last reply 18 Apr 2024, 20:18 Reply Quote 0
    • undefined JRCL marked this topic as a question 18 Apr 2024, 17:52
    • undefined
      Phaedrux Moderator
      last edited by 18 Apr 2024, 19:32

      @chrishamm

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • undefined
        chrishamm administrators @JRCL
        last edited by chrishamm 18 Apr 2024, 20:18

        @JRCL You can use M586 C"*" to permit all cross-origin requests, e.g. from your HTTP dev setup running on localhost. HTTP requests are documented for standalone and SBC mode. OpenAPI definitions are available on the repos as well.

        Duet software engineer

        undefined 1 Reply Last reply 18 Apr 2024, 23:54 Reply Quote 0
        • undefined
          JRCL @chrishamm
          last edited by 18 Apr 2024, 23:54

          @chrishamm I'm sorry I'm not much of a software engineer so pardon my ignorance, I'll need some additional clarification. Would the C"site" be the site requesting the HTTP post like the backend of my app, like a localhost:3000? Or whats a correct "site" if not?

          undefined 1 Reply Last reply 19 Apr 2024, 07:19 Reply Quote 0
          • undefined
            chrishamm administrators @JRCL
            last edited by 19 Apr 2024, 07:19

            @JRCL If you are unsure, just use * because that covers all sites, although that shouldn't be used in production environments. If you are interested in the CORS header that M586 C sets, read more about Access-Control-Allow-Origin here.

            Duet software engineer

            undefined 1 Reply Last reply 19 Apr 2024, 12:55 Reply Quote 1
            • undefined
              JRCL @chrishamm
              last edited by JRCL 19 Apr 2024, 12:55

              @chrishamm Thank you! I didn't realize you could literally use an asterisk. I thought it was a placeholder

              1 Reply Last reply Reply Quote 0
              • undefined JRCL marked this topic as a regular topic 19 Apr 2024, 12:55
              5 out of 6
              • First post
                5/6
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA