Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity 2017 - WWW 403 Forbidden Error [Bug?]

Discussion in 'Scripting' started by CavElliott, Jul 25, 2017.

  1. CavElliott

    CavElliott

    Joined:
    Mar 12, 2017
    Posts:
    3
    Hey Unity Forum, not entirely sure if this is a bug or if something has changed with WWW Class, however I upgraded my project which was working fine in Unity 5 to Unity 2017, since then whenever I use the WWW Class to post to a php file on a server I am getting 403 Forbidden errors.

    I have copied the string/url that it is posting to into my browser and it is working fine and like I said it was working fine in Unity 5, so not sure why this is not resulting in a 403 forbidden error.

    Here is the code used~

    string post_url = ""; // my url to php parser with parameters (?par1=meh) etc

    WWW post = new WWW(post_url);
    yield return post; // Wait until the download is done
    if (post.error != null)
    {
    Debug.LogError(post.error);
    }
    else
    {
    //success
    //but never gets here on Unity 2017
    }

    Not sure if this is actually a bug or if something has changed in 2017, will fill a bug report if someone can confirm this is not something wrong on my end.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    5,994
  3. CavElliott

    CavElliott

    Joined:
    Mar 12, 2017
    Posts:
    3
    Thanks for the suggestion but tried that, now receiving "Generic/unknown HTTP error", which is just a 403 forbidden error.

    edit- I think the problem is on my end, tried the exact same code on "google.com" and it worked, not sure what the problem could be though (I have allowed access via crossdomain.xml).

    Edit2 - Solved I believe, after messing around I decided to double check my crossdomain settings to realize that my ftp was timing out, turns out my host blocked my ip thus resulting in all of these problems (I believe). Apparently they blocked me because of use of "libcurl", I am guessing this is something done by Unity 2017.

    Getting whitelisted now, will update if this resolves the issue.

    Edit3 - Yes this fixed the issue, thanks to any one who took the time to look at this :)
     
    Last edited: Jul 25, 2017
  4. Skylabs

    Skylabs

    Joined:
    Aug 25, 2017
    Posts:
    2
    Hi @CavElliott ,

    i have the same problem than you (The 403 Forbidden error) when downloading AssetBundle. It's working good on a Wamp Server with localhost but when i try to use my server with a domain, it give me that error ( " Failed downloading bundle Windows from https://***/assetBundle/Windows/Windows: 403 Forbidden ")

    Visibly you was able to fix that problem but i cannot understand how you did that ! Can you explain your solution widely please ? :)

    I tried to add a crossdomain.xml at the root of my domain :

    <?xml version="1.0"?>
    <cross-domain-policy>
    <allow-access-from domain="*"/>
    </cross-domain-policy>

    But it didn't change something.

    You talk about the host that blocked your adresse IP. But when i go with my browser and try to download the assetbundle, it's work with no problem so i'm bit lost ! If you can help me, i'll be glad :D
     
  5. elhispano

    elhispano

    Joined:
    Jan 23, 2012
    Posts:
    36
    Hi guys! Same problem here. We were downloading files from Amazon S3 bucket and everything was working fine until we updated to Unity 2017.
    Tried to put the crossdomain.xml in the bucket without any luck.

    Help please! :p
     
  6. elhispano

    elhispano

    Joined:
    Jan 23, 2012
    Posts:
    36
    Hi again.

    We solve this issues changing from WWW to UnityWebRequest. In our case we have the files uploaded to an Amazon S3 Bucket and we are downloading the files using https and also we add some headers to the request.
     
  7. tajino

    tajino

    Joined:
    Apr 4, 2014
    Posts:
    1
    I'm getting 403 forbidden error as well with either WWW or UnityWebRequest, what are the server side settings that I have to change? I've tried .htaccess and crossdomain.xml to allow access, but it is still not working.

    tried the same script with other url on other servers and it works.
     
    Last edited: Jan 31, 2018
  8. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,841
    Are you doing POST requests to server?
    If so, try setting chunkedTransfer property to false on UnityWebRequest.
     
  9. JeroenDG

    JeroenDG

    Joined:
    Oct 16, 2017
    Posts:
    5
  10. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    Getting this in the recent version of unity 2017 as well. Help!
     
    Last edited: May 19, 2018
  11. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,841
    Are you using POST request with multipart sections?
    There is a known bug for this with fix in progress.
     
  12. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    333
    Yes, though I've decided to compile my app launcher/auto updater in Unity 5.6 as it doesn't use libcurl and seems to work.

    On another note, while you're here - my Unity compiled app launcher has a custom resolution which can't be changed as long as an existing registry key relating to it exists. See the thread below for more details:
    https://forum.unity.com/threads/cant-change-resolution-for-standalone-build.323931/