• WP Content Security Policy Log I get this

    Violated Directive	Blocked URL	Count	Action
    style-src	self	24	View Errors
    No host name set - you need to add this entry manually.

    Adding ‘self’ to style-src doesn’t help
    Adding https://example.com doesn’t help

    Same error for script-src

    How / where do I set the entry for host name manually?

    Ubuntu 16.04.2 server with multiple virtual hosts

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Dylan

    (@dyland)

    This is looking at the URI returned by the browser’s error report and trying to parse out the host name. For some reason the URI is not parseable by PHP (using parse_url). You can ignore this error and I’ll change the error report in a later version to include the URI.

    Thread Starter mattgilchrist

    (@mattgilchrist)

    Thanks Dylan

    So if that is my only error(s), I should be good to live?

    Plugin Author Dylan

    (@dyland)

    Yes – should be no problem. It’s probably a visitor using an odd browser that doesn’t report issues properly. You can clear the log and it should stop showing that issue.

    Thread Starter mattgilchrist

    (@mattgilchrist)

    It was me testing from Firefox 56.0.2 on my Windows 10 Pro workstation

    It happens every time I reload any of the pages

    Plugin Author Dylan

    (@dyland)

    So you’re running a local WordPress? It’s probably something to do with the URL being logged in error – you can use the Network tab of the browser’s developer tools to see what is being received by the server – it should be a normal URL, if its something else (such as a file system reference) that might cause the URL to not parse properly.

    The error is coming from line 431 of wpCSPAdmin.php which is the log page display routine, it should only happen on the log page. The underlying issue is line 324:
    parse_url( $obj->blocked_uri ) ;
    It either returns false or an array with no “host” field. You can change line 431 to either display the blocked URI (so you can see why its not parsing) or you can enter just after parse_url on line 324:
    if ( empty( $URIParts['host'] ) ) { continue ; }
    which will cause the system to ignore those lines.

    As I can’t recreate, let me know what works best so I put it in the underlying code.
    Dylan

    • This reply was modified 6 years, 9 months ago by Dylan.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No host name set’ is closed to new replies.