Web Push Php Library Example - Strict Origin When Cross Origin

1.1k views Asked by At

I used Web Push PHP library https://github.com/Minishlink/web-push-php-example to send push notifications, but I found a problem:

Referrer Policy: strict-origin-when-cross-origin

For your information, I used

  1. PHP --Version
PHP 7.2.34 (cgi-fcgi) (built: Nov  4 2020 16:02:13)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
  1. Link to this sample: https://i-confident.com/admin/web-push-php-example/src/index.html

Anyone can help me? Thanks in advance!

enter image description here

2

There are 2 answers

1
Hammad Ahmed khan On

use

header('Access-Control-Allow-Origin: *'); or both
header('Content-type: application/json'); (if want to access your json post data )

**in your send_push_notification.php file at the top**
and also use "www." for your url "https://i-confident.com/.." cause i recently face issue in which i didnt add www. in my url and was not receiving post/get data in my targeted file.
3
Dmitry Leiko On

First you need install php extension in my case:

sudo apt install php7.4-gmp

Also you need the checkout the branch:

git checkout v2.x

Then you should update your dependencies via composer:

composer update

And then it's should work I checked.

enter image description here