Unity 2017 - WWW 403 Forbidden Error [Bug?]

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.

Try using the UnityWebRequest class instead of WWW.

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 :slight_smile:

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 ? :slight_smile:

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

<?xml version="1.0"?>

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 :smile:

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! :stuck_out_tongue:

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.

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.

Are you doing POST requests to server?
If so, try setting chunkedTransfer property to false on UnityWebRequest.

1 Like

Hi,

I also am having a 403 forbidden error on this link
https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/18157385_10211565711252689_5506555522690097659_n.jpg?oh=d11ea3dd11a50773c071f90232294fb4&oe=5B4D4E4D

I’m just getting my profile pic to display in game.

any solutions for this?

Thanks.

Getting this in the recent version of unity 2017 as well. Help!

Are you using POST request with multipart sections?
There is a known bug for this with fix in progress.

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://discussions.unity.com/t/579459

I’ve fixed it by set “www.chunkedTransfer = true;”

1 Like

I follow your idea but it doesn’t work, any idea?

If setting useHttpContinue and chunkedTransfer both to false doesn’t help, then it’s most likely the problem with your request, such as missing credentials to access resource.

My first guess also was that it may be a permission issue.

Or The URL you’re trying to access is an “http” address while your site is hosted on an https server. https and http can not be mixed. The browser itself will block any http request from inside a https site.
Your URL starts with http://www.yoursite.com NOT https://www.yoursite.com

Also try to test your connection and run any VPN in background…

The same problem - http error 403
my problem was the host
because the host was free and it was limited.
i hope u can solve your problem.

Good night,
Although this has been open for a while now, wanted to raise the same issue.
I’m trying to access through a GET petition to a .json file. However, I’m getting the 403 error too from Unity, while I can access the file from the browser.
I’ve tried to change the .htaccess file without success, any ideas?

I think I have the same issue @CavElliott had, but I’m not sure how did he change to have it whitelisted in his server.
I’m using Unity 2018.4.36f1 and UnityWebRequest,
Thanks in advance,

Please start a new thread rather than hijacking other folks’ threads for your error.

Networking, UnityWebRequest, WWW, Postman, curl, WebAPI, etc:

And setting up a proxy can be very helpful too, in order to compare traffic: