http_upload cors problem with external web app

hi

i use movim https://github.com/movim/movim as a web xmpp client for my ejabberd server.
i have movim run on another domain than my ejabberd server
when i try to upload a file or picture in movim, i get an cors error in chrome console:

XMLHttpRequest cannot load https://upload.myejabberdserverdomain.tld:5443/somehashfilename.png. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://movim.mymovimdomain.tld' is therefore not allowed access.

in my ejabberd.yml i have:

    port: 5443
    module: ejabberd_http
    certfile: "/etc/ejabberd/cert/upload.myejabberdserverdomain.tld.pem"
    tls: true
    ##access: server_users
    access: all
    request_handlers:
      "": mod_http_upload

mod_http_upload:

mod_http_upload:
    docroot: "/var/www/vhosts/myejabberdserverdomain.tld/uploads/"
    ##host: "upload.%HOST%"
    put_url: "https://upload.@HOST@:5443"
    custom_headers:
      "Access-Control-Allow-Origin": "*"
      "Access-Control-Allow-Methods": "GET, POST, PUT, OPTIONS"

but this won't work

uploads from other clients work (gajim, conversation, monal,...), so http_upload works in general.

any ideas how to fix my cors problem?

greetings
rob

I had the same issue. I added

I had the same issue. I added to my config:

custom_headers:
      "Access-Control-Allow-Origin": "*"
      "Access-Control-Allow-Methods": "GET, POST, PUT, OPTIONS, DELETE"
      "Access-Control-Allow-Headers": "Content-Type, Origin, X-Requested-With"

and it worked!

Syndicate content