Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Andrea Ferro

    (@unicorn03)

    Hi @arthurdent2003, thanks for the feedback. If you need any help I am at your disposal.

    Thread Starter arthurdent2003

    (@arthurdent2003)

    Hey Andrea @unicorn03 ! Thanks!

    I came up to the problem where I need to remove the “Allow-Methods DELETE etc. from the headers. My idea is to override the HEADER Output by using something like

    Header set Access-Control-Allow-Methods “GET,PUT,POST”

    via filter. But at the moment I don’t know the best way to do so. I changed the code directly in the Plugin and I am getting the correct output – but of course this is not the best way. Do you have an idea how to make it work?

    Override via function in functions.php or better a little plugin to do this?

    Thanks!

    I tried this – but it doesn’t work:

    add_filter('wp_headers','Headers_Security_Advanced_HSTS_WP_Headers_custom', 99, 12);
    
    function Headers_Security_Advanced_HSTS_WP_Headers_custom($headers) { 
    // Do your logics here
    	  $headers['Access-Control-Allow-Methods'] = 'GET,PUT,POST';
    
    	  return $headers;
    }
    
    add_filter( 'wp_headers', 'Headers_Security_Advanced_HSTS_WP_Headers_custom' );

    Maybe I am missing something?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘acess-control-allow-methods Problem’ is closed to new replies.