Cannot send webhooks to Fluxer via client-side JS

(#322) Bug Closed: Fixed api

Summary

I have my own static web app that uses client-side JavaScript to send messages via webhooks. It supports Discord, and I wanted to see if it could also support Fluxer, but I get CORS-related errors when trying to send anything to Fluxer. I assume it's related to how Fluxer seemingly doesn't add CORS Access-Control-Allow-Origin header in webhook responses, and Discord seemingly does, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default

Steps to reproduce

  1. Add a webhook in a Fluxer channel
  2. Go to any webpage
  3. Open browser console
  4. Paste and run this minimal example (replacing webhook url)
    var webhookUrl = 'https://api.fluxer.app/webhooks/ID_HERE/KEY_HERE'; // Replace with your webhook URL
    
    var payload = {
      content: 'Hello from browser console!',
      username: 'Console Tester',
      embeds: [
        {
          title: 'Test Embed',
          description: 'This is a simple test message.'
        }
      ]
    };
    
    fetch(webhookUrl, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload)
    })
  5. Get an error
  6. (Optional) refresh the page, replace with discord webhook link, and run again

Environment (optional)

Browser: Mozilla Firefox

Logs or screenshots (optional)

image Learn more leads to docs page I linked in summary

4 comments

Sign in with Fluxer to comment and vote.
Comment by Rex
RexSystem 1 vote edited
Status changed from Fixed to Awaiting confirmation
This may be fixed in the current version. If it still happens for you, please say so here.
Comment by Rex
RexSystem 1 vote
Status changed from Awaiting confirmation to Fixed
Fixed. Webhook requests now work from the browser because they allow cross-origin requests.
Comment by @PilkeySEK
RexSystem 1 vote originally by @PilkeySEK on GitHub
Have you tried web.fluxer.app/api/...?
Comment by @mailbun
RexSystem 1 vote originally by @mailbun on GitHub OP
That doesn't seem to make any difference for me.