CORS (Cross-Origin Resource Sharing
-
Hello guys,
Recently i did a site for a client. After receiving it the client sent the site for acunetix security check, which brought back this alert.
—-acunetix alert—
Access-Control-Allow-Origin: https://www.example.com Access-Control-Allow-Credentials: true Any origin is accepted (arbitrary Origin header values are reflected in Access-Control- Allow-Origin response headers). For the WordPress /wp-json/ endpoint, this may be the intended behavior and requires manual review. For further information, please refer to the WordPress REST API Handbook linked in the "References" section below.
— the end of acunetix alert —
i finally found where this is located – in rest-api.php
function rest_send_cors_headers( $value ) { $origin = get_http_origin(); if ( $origin ) { // Requests from file:// and data: URLs send "Origin: null". if ( 'null' !== $origin ) { $origin = esc_url_raw( $origin ); } header( 'Access-Control-Allow-Origin: ' . $origin ); header( 'Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE' ); header( 'Access-Control-Allow-Credentials: true' ); header( 'Vary: Origin', false ); } elseif ( ! headers_sent() && 'GET' === $_SERVER['REQUEST_METHOD'] && ! is_user_logged_in() ) { header( 'Vary: Origin', false ); } return $value; }
Can anyone let me know what should i do in this case.
thank you so much in advance.The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘CORS (Cross-Origin Resource Sharing’ is closed to new replies.