Problem loading page once security enabled

I have a page that is working fine, but as soon as I enable site security (by clicking on App, Security Provider Enforcer) I get the following error -:

Removing the php code that is added at the top of the page when the security provider is enabled solves the issue and the page loads again.

I have other pages where the security is working fine and I can’t find any missing dependencies, but I guess something is missing somewhere…

I currently include jquery-3.3.1.slim.min.js - I tried changing this to the “non-slim” version thinking that something might be missing in this version, but that didn’t help.

Any thoughts on resolving this would be much appreciated.

Make sure the /dmxAppConnect/dmxBootstrap4Modal folder and it’s contents are uploaded correctly

Thanks. I believe it is - I have modals on the page and other parts of the site that work fine when security is not enabled - it just breaks after I enable the site security enforcer - that’s the only change that is made.

There is only a single file to upload in this folder as far as I can tell, so I think the scope to get it wrong is low :slight_smile: .

After much messing around it seems that this is related to the location in the file where Wappler is putting the bootstrap dependencies.

Wappler insists on adding this to the end of the file -:

If we leave this here, then the page doesn’t load when security is enabled. I need to add the bootstrap script to the header of the file as well.

I would have thought that if Wappler insists on adding these dependencies, it would add them to the right place?

@George or @Teodor is there a reason that these are added to the end of the file? Shouldn’t they just be added to the <head> - it seems that this prevents things working properly.

I think the standard location for these files is where Wappler puts them; that’s how it’s suggested on the Bootstrap website. I use lots of modals with security enabled and haven’t come across any problems. In fact I haven’t across any situation where I’ve needed to move these files. I don’t think this is the issue.

Well, I’m open to other suggestions. All I can say is that if I dont also add this into the <head> tag, it doesn’t work and I get the error mentioned at the top of this thread. That’s the only change made.

Maybe this is not the real root cause, and I’m open to other suggestions of course.

As I say, I haven’t come across the problem. In these situations I would create a very simple page from scratch, just with a modal and with security enabled, to make sure that works - eg that in principal, using modals in conjunction with the security feature is not an issue for any reason. If that works, then I would try to see what it is about the problem page which is causing the issue.

Thanks. I do have other pages that work fine with security, so I know that it works, but I have a couple of pages where when I added security, it stops loading unless I add the bootstrap to the top of the page.

Well, that’s what I’ve spent the day doing, and the conclusion was that I needed to add the bootstrap js file to the header. Without this I get the above error and I’ve not found anything else that has made it work.

I’m open to other specific suggestions though if you have any?

I would probably make a copy of the page and comment out or remove sections until it worked. I expect you’ve done something like this anyway,but at some point the page is bound to work and there should be a clue about what was causing the problem. Obviously you want to check for errors indicated within Wappler (at the bottom of the window). Perhaps one of the referenced files is the wrong version or in the wrong order.

Yes, that’s basically what I did. I also compared all the dependencies with other files that are working fine, but so far I’ve not contained the issue. Removing the modals solves the issue (not surprisingly given the error reported at the top), but I was not able to find anything more granular.

Was the PHP block of the security provider added before the HTML on the top of the page? Did you check if perhaps something else in the head changed after you added the security provider. The error is a bit strange, is it possible that you have 2 jQuery includes on the page?

Yes, it’s the first thing before the html.

Yes, I have this all running through a git repo, and there are no other changes to the file other than the security PHP at the top of the file.

I just checked and there is just a single jQuery.

What did you do with the boostrap includes, did you leave them at the end of the body or move them to the head. Make sure that it is only included ones. The javascript error you got normally only comes when there is some script double included and the second it overwriting the first code.

That’s not possible.

I have to include it in the head or it doesn’t load, and I can’t remove it from the end, since Wappler adds this automatically when I save the file.

So - it is in both places…