#47402 closed defect (bug) (worksforme)
Problem with Access-Control-Allow-Origin, on IOS Ionic 4 app
Reported by: | pienoz | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
[REQUEST_URI] => /wp-json/wp/v2/posts?per_page=20&_embed
[HTTP_ORIGIN] => ionic://localhost
In wp-includes/rest-api.php, function : rest_send_cors_headers()
$origin = 'ionic://localhost'
After esc_url_raw( $origin ),
$origin is null
Result : Access-Control-Allow-Origin:
instead : Access-Control-Allow-Origin: ionic://localhost
Error on IOS : origin is not allowed by access-control-allow-origin
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hello @pienoz, welcome to WordPress Trac!
ionic
is not part of the default list of supported protocols by wp_allowed_protocols(). But you can easily extend the list with the help of the kses_allowed_protocols filter:With this snippet you can continue to use
ionic
in the Origin header.