0

server.conf: https://dpaste.org/6Zgn

This is Apache's config in OpenServer.

Problem:

enter image description here

As far as I understand, it has somethins with Access-Control-Allow-Origin

I wrote:

Header set Access-Control-Allow-Origin "*"

It has not helped. I have either written to a wrong place of rsomething.

halfer
  • 19,824
  • 17
  • 99
  • 186
Kifsif
  • 3,477
  • 10
  • 36
  • 45
  • Someone says here they had to add a self-signed certificate as well to make this work, https://stackoverflow.com/a/66555660/1427878 (But before going through that trouble, I would perhaps check if other browsers have already implemented this security feature as well, maybe you can still test in Firefox without any further modifications, idk.) – CBroe Oct 21 '21 at 08:32
  • Another option would probably be to simply update the site address in the WP configuration, so that it actually matches the ngrok hostname - because it looks to me like the issue here stems from the fact that WP is still creating _absolute_ URLs for almost anything. If it was creating all those URLs with the proper hostname and HTTPS to begin with, you would not have this issue here with that kind of setup. (But I guess that only makes sense with a paid ngrok account, and not with the free version where the hostname will change all the time.) – CBroe Oct 21 '21 at 08:35

1 Answers1

0

this is because the server is blocking the frontend to make requests. I faced the same error for a long time

The only possible solution for this situation is to allow the host from the server-side.

Whichever backend you are using, search for a way to somehow allow the domain host from there.

for eg, for PHP

<?php
    if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
        header('Access-Control-Allow-Origin: *');
        die();
    }

    // some other code

?>

more resource: Cross-Origin Request Headers(CORS) with PHP headers