• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Voovvo

New Pleskian
Server operating system version
Centos 7
Plesk version and microupdate number
18.0.40 Update #1
I'm trying to add external payment method integration to my React app. I'm sending a fetch request to the external payment method's API application, but I'm getting the following error.

This is my fetch code.
JavaScript:
 async getPaymentsAccessToken() {
    const msg = await request<PaymentsAccessTokenResponse>(`https://apitest.crossdomain.com/accesstoken/get`, {
      method: 'POST',
      prefix: undefined,
      mode: 'cors',
      credentials: 'include',
      headers: {
        'Content-Type': 'application/json',
        client_id: this.client.client_id,
        client_secret: this.client.client_secret,
        'Ocp-Apim-Subscription-Key': this.client['Payments-Subscription-Key'],
      },
    });
    return msg;
  }

I got this error
Access to fetch at 'https://apitest.crossdomain.com/accesstoken/get' from origin 'mydomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
None of the settings I made on Plesk Apache and Nginx work.

THIS ARTICLE NOT WORKING... !!!
https://support.plesk.com/hc/en-us/...s-origin-resource-sharing-in-Plesk-for-Linux-
 
Hi,

This is not necessarily a Plesk issue. You better post this on StackOverflow, where the React community can help you:

 
Hi,

This is not necessarily a Plesk issue. You better post this on StackOverflow, where the React community can help you:


But I got this error, Shouldn't this error have something to do with plesk?
Access to fetch at 'https://apitest.crossdomain.com/accesstoken/get' from origin 'mydomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
 
Asking for help here every day isn't helpful. The lack of response on this topic is likely because of the fact this a specific issue to your setup which makes it hard for someone in the community to help you.

You'll have to do the trouble shouting yourself to find a solution to your problem. If you feel it's any issue with Plesk I suggest you contact Plesk support.
 
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "YOUR-DOMAIN.TLD"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});

app.get('/', function(req, res, next) {
// Handle the get for this route
});

app.post('/', function(req, res, next) {
// Handle the post for this route
});


// this might help some one
 
Back
Top