dcasia / nova-filepond

A Nova field for uploading File, Image and Video using Filepond.
MIT License
48 stars 27 forks source link

XMLHttpRequest issue - http:// redirection #41

Closed jaymeh closed 10 months ago

jaymeh commented 10 months ago

Hi,

I'm having a few issues when trying to load files via the plugin, seemed to work fine locally but when putting it onto another server it seems to have caused issues. To my knowledge there aren't any firewalls or proxies in place.

Mixed Content: The page at 'https:///nova/resources/asset-resources/5' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http:///nova-vendor/nova-filepond/load?serverId='. This request has been blocked; the content must be served over HTTPS.

Just wondering if you may know of a workaround for this or any ideas?

I've set my APP_URL environment variable to use https://.

It does seem like the server is trying to do a redirect because the url parameter has a trailing slash then a ? on line 74:

load: `/load/?serverId=`,
milewski commented 10 months ago

This happens if your Laravel application doesn't trust your reverse proxy, you can configure your trust proxy Middleware to trust the request comming from your proxy, this issue is not specifically to this package but I belive all your urls would generate http instead of https...

The laziest solution is just add:

protected $proxies = '*';

to your trustedproxy Middleware, you could try just to confirm if this is what causing the issue.

jaymeh commented 10 months ago

Thanks, I tried this on our environment and it didn't seem to resolve the issue.

I've just had a look at the load function and rebuilt the Filepond module with the load line like this: load: /load?serverId= and it seems to resolve the issue for me.

Is it possible this change could be made or is there a reason for the trailing slash before the query parameter?

Thanks