After more investigation, I discovered that the issue wasn’t caused by my code or configuration. It turned out that some malicious code had been injected into my site files, which was interfering with normal functionality.
Once I removed the injected code and restored clean versions of the affected files, everything started working correctly again.
If anyone else runs into similar unexpected behavior, it might be worth checking for unauthorized or altered files in your project, especially if you’re hosting the site publicly.