[Fixed] Plesk | Collection images not loading — api.php blocks /images/ paths + double api.php URL

Bug 1 — api.php blocks /images/ paths

In api.php (generated by Sitejet on every publish), this line:

$isAllowedGet = $requestMethod === ‘GET’ && preg_match(‘#^/(form_container|collection|website)/#’, $url);

…only whitelists form_container, collection, and website as valid GET paths. The “images” path is missing. Any request to /api.php/images/… is rejected — api.php returns an empty response instead of proxying the image.

Fix: add |images to the regex:

$isAllowedGet = $requestMethod === ‘GET’ && preg_match(‘#^/(form_container|collection|website|images)/#’, $url);

Since api.php is overwritten on every Sitejet publish, this fix is lost each time. There is no permanent server-level workaround — we currently have to make api.php read-only to preserve the fix, which is not sustainable.


Bug 2 — Double /api.php/ prefix in image URLs

When a collection page loads, Sitejet’s JavaScript fetches collection data via /api.php/collection/… (correct). The API response includes image paths that already contain /api.php/images/… The JavaScript then prepends the api base URL again, resulting in:

/api.php/api.php/images/800x800/{fileId}/{filename}.jpg

Instead of the correct:

/api.php/images/800x800/{fileId}/{filename}.jpg

This is visible in the browser Network tab on any collection item page.


Why some images can be partially fixed and others cannot

Images that Sitejet has synced to the local /images/ directory can be served with a server-side .htaccess rewrite as a workaround. However, newer listing images that exist only in Sitejet’s cloud (not on the local server filesystem) return 404 at every local path (/images/0/, /images/800x800/, /images/1920/, etc.). These images must go through api.php to be proxied from the CDN. Since api.php blocks /images/ paths, these images are completely inaccessible and no server-side workaround can fix them.

Example page where cloud-only images are broken: Elementen 38 - Woningaanbod: overzicht - Greenfield Makelaardij | Makelaar & Bouwconsultancy Randstad (Media tab)


Steps to reproduce

  1. Set up a Sitejet website with a collection containing images (e.g. real estate listings)
  2. Publish to a Plesk server
  3. Open any collection item page and check the image/media tabs
  4. Open browser DevTools → Network tab → filter by “api.php”
  5. All image requests return 404

Requested fixes

  1. Add “images” to the allowed GET paths in api.php — this is a one-line change and resolves the proxy blocking permanently
  2. Fix the client-side URL construction so image paths from the collection API response are not prefixed with /api.php/ a second time

Both fixes are needed. Fix 1 is critical for images that only exist in Sitejet’s cloud. Fix 2 prevents the double-prefix issue that requires server-side rewrites as a workaround.

Nice, @Martinus_Visser. :oncoming_fist:

I have marked this as a Plesk issue and forwarded it to the colleagues there. Did you also sent a ticket to Plesk as per advice from Martin?

Hi Andre,

I did send the same message to Plesk, awaiting reply… :ok_hand:

Hey @Martinus_Visser, we just pushed a fix. Could you ensure that you update your Sitejet Builder extension on your server - if it doesn’t auto-update and then publish your website again and check if your blog images are visible?

Hi Franzi!

I think the update did the job!

Thanks!