Hello @berislavgrgicak,
We hope you’re doing well.
Thank you for taking the time to create a blueprint and testing link for our review. Our Smush team will review it shortly, and we will follow up with you soon.
We appreciate your efforts.
–
Kind Regards,
Imran Khan
Hi @berislavgrgicak,
We ran checks regarding this and noticed issues with how the plugin interacts in the Playground. It seems there are limitations on external API requests. We noticed the following error when the images uploaded were optimized via the plugin by running Smush:
[medium] Error posting to API: Missing header/body separator
Could we know if there are any restrictions on how the external API request is supposed to work in the Playground? Any suggestions you have regarding the above that should be considered in Playground?
Looking forward to your response.
Regards,
Nithin
Hello @berislavgrgicak,
I hope you’re doing great today!
We haven’t heard from you for a while, so we’re marking this thread as resolved for now. Please feel free to reopen the thread when you have any further updates.
Best Regards,
Dmytro
Thread Starter
Bero
(@berislavgrgicak)
Hi!
Sorry about the late, reply I missed your message.
> Could we know if there are any restrictions on how the external API request is supposed to work in the Playground? Any suggestions you have regarding the above that should be considered in Playground?
I didn’t recreate your error, but a common issue is CORS headers. When running Playground in the browser it can make requests only if CORS requests are allowed.
You can check that in the browser network tab, by observing the failing request.
If CORS requests aren’t allowed Playground will attempt to use it’s CORS proxy to work around it, but in the process it will strip some headers like Authorization.
To work around it you could enable CORS requests in your API endpoints.
Alternativly, you can add a X-Cors-Proxy-Allowed-Request-Headers=Authorization header to your requests. This will allow Playground’s CORS Proxy to forward the Authorization header to your server.
It might be hard to debug this over the support forum, feel free to ping me on the WordPress community Slack (@bero).
Hi @berislavgrgicak,
Thank you for getting back to us. I have shared the feedback with the Smush team for further review. We’ll reach out to you if we need any further clarification.
Thanks again.
Best Regards,
Nebu John