Skip to main content
Topic: Quote and Edit stopped working after moving to https (Read 654 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Quote and Edit stopped working after moving to https

Hello.

After moving to https I had several malfunctions in the forums, the worst of them being the "Quote" and "Quick Edit" buttons not working: the first one triggers the "Loading" window on the top, but it just never loads. The second one triggers the same loading window and it quickly goes away, but then I just can't edit anthing. It's like I never pressed the button.

I changed every url to https, including some I had to do manually, emptied the cache multiple times (both on the forums and my browser) and nothing. I don't know what to do anymore.

I have current Elk version and 7.3.26 PHP version. Mods installed: Optimus, Snow and Google Analytics Tracking.

Re: Quote and Edit stopped working after moving to https

Reply #1
I would download and run repair_settings to ensure that all the paths are updated. Do you get any errors in the console when clicking the link to edit/quote I would guess that’s where it’s failing.

Re: Quote and Edit stopped working after moving to https

Reply #2
Missed your elk version, but hope is 1.1.x ... as @tino said repair settings may help.   Also open your browser console ,F12, and see if it tossing out some errors which may help in diagnosing the problem.
Be safe, Be kind, Happy Programing

Re: Quote and Edit stopped working after moving to https

Reply #3
@Spuds 1.1.6
I tried to run repair_settings but it gets me a 403 error. Should I change permissions? If yes, to what?

From console:
Code: [Select]
 Uncaught TypeError: Cannot read property 'new_from_last' of undefined      desktop-notify.js?R116:337
    at Object.send (desktop-notify.js?R116:337)
    at send (script_elk.js?R116:1504)
    at Object.<anonymous> (script_elk.js?R116:1517)
    at i (jquery-3.1.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-3.1.1.min.js:2)
    at A (jquery-3.1.1.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-3.1.1.min.js:4)

Re: Quote and Edit stopped working after moving to https

Reply #4
That 403 is more likely I need to check repair settings compatability with php 7.3/7.4 .... let me take a look at that first.
Be safe, Be kind, Happy Programing

Re: Quote and Edit stopped working after moving to https

Reply #5
Did a quick check and it seems fine on 7.4.  Make sure you are using the one from: https://github.com/elkarte/tools/tree/master/repair_settings

and that you put it in the root of you forum. 
Be safe, Be kind, Happy Programing

Re: Quote and Edit stopped working after moving to https

Reply #6
Using it but still get the 403 error.

Re: Quote and Edit stopped working after moving to https

Reply #7
For the reference, since the same question was asked on the SMF Italian forum too at:
https://www.italiansmf.net/forum/index.php?topic=2903.0
what I've seen there is that the XML returns a wrong content-type (html instead of xml), so the responseXML is null and the js code doesn't do its job.
TBH I'm not sure what it could cause that, but I don't remember breaking so badly the code, so I assume it could be some server configuration. *shrugs*
Bugs creator.
Features destroyer.
Template killer.

Re: Quote and Edit stopped working after moving to https

Reply #8
That 403 is more likely I need to check repair settings compatability with php 7.3/7.4 .... let me take a look at that first.
Guess it wasn't then.

After upload it has the 644 permissions code (meaning reading and writing available for the user, but not execute, while world and group only have the read one).

Re: Quote and Edit stopped working after moving to https

Reply #9
Do you have a website address that shows what issue you are having, PM me if you want.

Did you try 664 or simply 777 (since its not like you are going to, or ever should, leave that file on the server)

Be safe, Be kind, Happy Programing

Re: Quote and Edit stopped working after moving to https

Reply #10
So, we managed to solve it by modifying script.js and adding this line in a bunch of functions.

For the Quote button
Code: [Select]
function getXMLDocument(sUrl, funcCallback)
{
var oMyDoc = new XMLHttpRequest(),
bAsync = typeof(funcCallback) !== 'undefined',
oCaller = this;

oMyDoc.overrideMimeType('text/xml');

Quick Edit
Code: [Select]
function sendXMLDocument(sUrl, sContent, funcCallback)
{
var oSendDoc = new window.XMLHttpRequest(),
oCaller = this;

oSendDoc.overrideMimeType('text/xml');

Forgot to tell that the "Mark all mex as read" at the bottom shows issues too (it works but the "Loading..." bar on top never goes away). What should I modify?

Re: Quote and Edit stopped working after moving to https

Reply #11
To note, the fundamental problem is that the server is responding with type text/html instead of text/xml for xml / xhr responses   That means most any ajax call is being returned wrong.  I provided a fix for a couple of areas but I would suspect that most ajax calls will get mangled.

I found a workaround for using oSendDoc.overrideMimeType('text/xml'); to tell JS to still interpret the incorrect response as an XML Document and not text.  So that will fix several areas but there are more.

This is a bit like a server sending an image file back as text instead of binary and hoping the receiving program can figure it out  :D

If someone knows Apache, maybe you can provide some thoughts as to why it would be sending things back wrong?  I have not used Apache in so long that I'm really not that familiar with its setup, I do remember that the mime types used to be in a file mime.types but thats about all.
Be safe, Be kind, Happy Programing