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

    HTTP Endpoint and Cross-Origin Site

    Scheduled Pinned Locked Moved
    General Discussion
    3
    6
    202
    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.
    • JRCLundefined
      JRCL
      last edited by

      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?

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • JRCLundefined JRCL marked this topic as a question
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        @chrishamm

        Z-Bot CoreXY Build | Thingiverse Profile

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

          @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

          JRCLundefined 1 Reply Last reply Reply Quote 0
          • JRCLundefined
            JRCL @chrishamm
            last edited by

            @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?

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

              @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

              JRCLundefined 1 Reply Last reply Reply Quote 1
              • JRCLundefined
                JRCL @chrishamm
                last edited by JRCL

                @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
                • JRCLundefined JRCL marked this topic as a regular topic
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA