Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Origin header in Chrome Extension

I have my api running on node js, where for security reasons, I have set up a middle ware function check the origin header, if it is from my website, then only the api should go ahead. I am finding issues with Chrome Extension, as it does not pass the origin header in the get requests, also in the put requests, it sends something like chrome:// as the origin header. Can somebody help?

Regards, Manik Mittal

like image 643
Manik Mittal Avatar asked Oct 30 '22 10:10

Manik Mittal


1 Answers

Well, that's how Chrome sets the Origin for extensions. It's not simple to override.

It is, however, possible to override. You'll need to use the webRequest API, specifically a blocking response to onBeforeSendHeaders, to rewrite the origin to whatever you like.

like image 91
Xan Avatar answered Nov 15 '22 05:11

Xan