player icon indicating copy to clipboard operation
player copied to clipboard

Unable set request headers

Open NivinCNC opened this issue 1 year ago • 2 comments

Current Behavior:

image Refused to set unsafe header "Referer"

Expected Behavior:

Need to set custom header

Steps To Reproduce:

function onProviderChange(
  provider,
) {
  if (isHLSProvider(provider)) {
    provider.config = {
      xhrSetup(xhr) {
        xhr.setRequestHeader('Referer', `https://embedwish.com/`);
      },
    };
  }
}
 <MediaPlayer
        onProviderChange={onProviderChange}
        ref={playerRef}
        title={(movieInfo?.title || movieInfo?.name)?.length > 20 ? `${(movieInfo?.title || movieInfo?.name).slice(0, 20)}...` : (movieInfo?.title || movieInfo?.name)}
        viewType='video'
        logLevel='warn'
        autoPlay = {true}
        crossOrigin
        playsInline
        src={`${videoInfo?.server}`}
        onTimeUpdate={throttledSaveProgress}
        onDurationChange={e => setDuration(e)}
      >
        <MediaProvider />
        <DefaultVideoLayout icons={defaultLayoutIcons} />
      </MediaPlayer>

Environment:

  • Framework: React
  • Meta Framework: Next.js

NivinCNC avatar Dec 21 '24 13:12 NivinCNC

You cannot change the Referer header, that is a security measurement enforced by the browser.

Curetix avatar Dec 31 '24 12:12 Curetix

Is there any other way to change?

NivinCNC avatar Jan 07 '25 19:01 NivinCNC