developerforce / Force.com-JavaScript-REST-Toolkit

ForceTK - a minimal Force.com REST API for JavaScript apps
BSD 3-Clause "New" or "Revised" License
315 stars 175 forks source link

503 error on Community page #76

Open jonathanwiesel opened 9 years ago

jonathanwiesel commented 9 years ago

Implementing the file upload functionality I noticed that when the Visualforce page is in a community I get a 503 error:

POST https://community-url.cs17.force.com/services/data/v33.0/sobjects/ContentVersion/ 503 (Service Unavailable)

forcetk.Client.blob @ forcetk:325
forcetk.Client.createBlob @ forcetk:346
upload @ UploadAttachment?pid=003g000000b0uIZAAY:153
onclick @ UploadAttachment?pid=003g000000b0uIZAAY:225

Any workaround or fix?

wimvelzeboer commented 8 years ago

I have the same problem. Did you find a solution for this?

wimvelzeboer commented 8 years ago

I have found the solution: You must add the SitePrefix to the url: https://community-url.cs17.force.com/services/data/v33.0/sobjects/ContentVersion/ should be: https://community-url.cs17.force.com/{!$Site.Prefix}/services/data/v33.0/sobjects/ContentVersion/

tanwanimanisha commented 6 years ago

Hi @wimvelzeboer, I am facing a similar issue. This works fine if I add Remote Site Setting for custom URL but do you know if we can fix this using code by adding site prefix to the login URL?