WordPress Rest API doesn’t appear to handle custom URL schemes

[ad_1]

Hello,

I am attempting to create an Ionic Capacitor that communicates with WordPress for login details.

However Capacitor uses “capacitor://localhost” as the origin header when it talks to WordPress. WordPress will then return an empty Access-Control-Allow-Origin header which means CORS will fail.

I’m not able to change the scheme to “http” or “https” as those are reserved by WKWebview.

You can check this out in Postman by sending a request to your WordPress site with “custom://origin” set as the Origin Header in requests.

I’ve managed to replicate this issue on a completely blank site with only default theme and plugins.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer