Xdg-open works with firefox but not with chromium/brave

If I do xdg-open http://fsfe.eu/ with firefox as default browser, then the page opens in firefox.
If I do xdg-open http://fsfe.eu/ with chromium or brave as default browser, then a new instance of the browser starts up and only shows the default start page.

Can anyone help me on where I should start debugging this?

Cheers,
/JP

OK, so to enable chromecasting, I have the following (via homemanager):

programs.chromium = {
    enable = true;
    package = pkgs.chromium.override {
        # https://peter.sh/experiments/chromium-command-line-switches/
        commandLineArgs = ''
        --load-media-router-component-extension=1
        --enable-media-router
        --enable-smooth-scrolling
        '';
      };
};

If I instead install the vanilla chromium without the above, then xdg-open works as expected. Why is that?

Well, it turns out that casting actually works out of the box now, so my specific problem is fixed. But I still don’t understand what made xdg-open not work…

I found out that just using commandLineArgs option directly work just fine:

{
  programs.chromium = {
    enable = true;
    # https://peter.sh/experiments/chromium-command-line-switches/
    commandLineArgs = [
      "--load-media-router-component-extension=1"
      "--enable-media-router"
      "--enable-smooth-scrolling"
      "--force-dark-mode"
    ];
  };
}