<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>165754</bug_id>
          
          <creation_ts>2016-12-12 05:57:34 -0800</creation_ts>
          <short_desc>iOS Refused to connect because it appears in neither the connect-src directive nor the default-src directive of the Content Security Policy</short_desc>
          <delta_ts>2016-12-15 14:14:20 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 10</version>
          <rep_platform>All</rep_platform>
          <op_sys>iOS 10</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Brandsma">erik.brandsma</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1259022</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Brandsma">erik.brandsma</who>
    <bug_when>2016-12-12 05:57:34 -0800</bug_when>
    <thetext>Info:
- iOS 10.1.1
- iPhone 5s

This also happens on:
- MacOS Sierra 10.12.1
- Safari Version 10.0.1 (12602.2.14.0.7)

This occurs probably due to: https://webkit.org/blog/6830/a-refined-content-security-policy/
Stackoverflow post I made about this: http://stackoverflow.com/questions/41102298/ios-refused-to-connect-because-it-appears-in-neither-the-connect-src-directive-n 

So I have a phonegap app which uses socket.io to handle communication between the server and the app clients.
a typical URL to do so would be:
ws://10.0.1.63:3000/socket.io/?EIO=3&amp;transport=websocket&amp;sid=xTaMJwP3rVy3UnIBAAAi

When it tries to connect it says:
Refused to connect to ws://10.0.1.63:3000/socket.io/?EIO=3&amp;transport=websocket&amp;sid=xTaMJwP3rVy3UnIBAAAi because it appears in neither the connect-src directive nor the default-src directive of the Content Security Policy.

Which seems like a really straightforward error, just add the URL to the Content Security Policy right? Wrong. When I do so by setting the CSP to: 
&lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;
                                default-src * data: blob: ws: wss:;
                                style-src * &apos;unsafe-inline&apos;; 
                                script-src * &apos;unsafe-inline&apos; &apos;unsafe-eval&apos;;
                                connect-src * ws: wss:;&quot;&gt;

I still get the very same error.
I obviously cannot add &quot;ws://10.0.1.63:3000/socket.io/?EIO=3&amp;transport=websocket&amp;sid=xTaMJwP3rVy3UnIBAAAi&quot; because the hash at the end is randomly generated.
How can I make sure that this will work? Or is this a bug in webkit? Because when I tested the exact same code in Chrome / Android it worked just fine, probably because Chrome / Android is more lenient when it comes
to letting through connections. That is ok as long as I am able to fix this. How can I do so?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1260257</commentid>
    <comment_count>1</comment_count>
    <who name="Erik Brandsma">erik.brandsma</who>
    <bug_when>2016-12-15 14:14:20 -0800</bug_when>
    <thetext>This is already fixed, the problem was that I had two Content-Security-Policy meta tags in the &lt;head&gt;&lt;/head&gt; section. The later one was more strict causing it to refuse the ws: connection</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>