Adding custom header to HTTP requests

Hi,

I’m looking for a way to add a custom header to all http(s) requests coming out of a Capacitor app.

A little more background:

For my use-case i would like to use server.url to load the app content online (an existing PWA app). However the webserver serving the PWA app requires a secret to be provided in a header (used to limit who can access the app).

I’m trying to figure out how to intercept all the requests being made by Capacitor and add the custom header. Could be either in javascript, via some plugin or even modifying the code for the native apps.

If anyone has a solution or some hints it would be much appreciated.

Best,
Olav