wrav / related

A simple plugin that adds a widget within the Craft CP page sidebar, allowing you to quickly and easily access related entries.
MIT License
5 stars 4 forks source link

Possible issue with action path url in Related.js #14

Closed gavinplatt closed 1 year ago

gavinplatt commented 2 years ago

Thank you for this plugin, it's a massive help for our editors.

I'm hitting an issue using this plugin on a site which uses HTTPS. Works fine on local and staging which are HTTP.

When I load an entry within the CP, I see this error in the console:

Mixed Content: The page at 'https://www.domain.com/admin/entries/entry-section/985810-entry-title' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.domaincom/actions/related/default/?id=985810&sectionId=37&userId=&categoryId='. This request has been blocked; the content must be served over HTTPS.

The action URL is using HTTP rather than HTTPS. The site is a pretty standard setup – base URL settings in .env are using HTTPS, .htaccess isn't doing anything with https, there are no plugins like Patrol running, and it's a LetsEncrypt SSL cert.

I can get around this error by setting editing line 28 in Related.js to:

url: "/admin/actions/related/default?id=" + id + "&sectionId=" + sectionId + "&userId=" + userId + "&categoryId=" + categoryId,

Note the addition of '/admin' at the start. This doesn't feel like a proper fix, maybe just a nice coincidence, so I didn't want to open a PR.

I'm wondering if this URL should be set to something else? E.g. currently it also doesn't respect Craft's actionTrigger setting.

Thanks for any pointers.

reganlawton commented 2 years ago

@gavinplatt I'm just about to go into a surgery this morning and gonna be away from computer for a week. So I'm be able to take a look into it when I'm back.

reganlawton commented 1 year ago

Updated in latest v2.1.0