Ajax error when attempting component updates - joomla

I am having a couple of issues with a Joomla 3.6 site that I maintain.
Issue 1 is with the Joomla update component. When the update attempts to run it gets an Ajax alert error, and the following error in console:
XMLHttpRequest cannot load http://www.example.com/administrator/components/com_joomlaupdate/restore.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
The second issue is with uploading images. Whenever I try to upload an image either in the media manager, an article or module, the site acts like it's uploading the image, refreshes, but never actually uploads the image.
I have error reporting turned on maximimum and still no errors after the routine finishes. I have to say I am completely beside myself as to what is going on.
UPDATE
the php error log reads:
[08-Sep-2016 03:45:49 America/Chicago] PHP Notice: Undefined variable: result in /mnt/stor1-wc2 dfw1/417008/591382/www.example.com/web/content/libraries/joomla/mail/mail.php on line 479

Re. Your Ajax issue -
XMLHttpRequest cannot load http://www.example.com/administrator/components/com_joomlaupdate/restore.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
It's clearly a cross origin issue. You should add www in the ajax url or remove from domain. It would be better if you get ajx url dynamically from JS. So if www in the domain add that to Ajax request otherwise not.
2)Re. upload issue - You should check folder permissions. This might be due to not having proper permission to size limit. One can check permission under Folder Permissions tab from below url(make sure to change host).
http://www.example.com/administrator/index.php?option=com_admin&view=sysinfo

Related

Shopify proxy is not working with manifest.json (shopify and laravel)

I'm a beginner in Shopify and trouble with Shopify proxy
Front Store: https://bhavin.myshopify.com
App Store: https://myapp.ngrok.io (Laravel)
I want to add two files (custom js and manifest.json) in my front store.
Install and authentication is working fine
I'm adding manifest.json something like that
var link = document.createElement('link');
link.rel = 'manifest';
link.href = 'https://myapp.ngrok.io/manifest.json';
document.head.appendChild(link);
1. Without proxy
manifest.json file added properly but throw error something like that
Access to resource at 'https://myapp.ngrok.io/manifest.json' from origin 'https://bhavin.myshopify.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
2. With Proxy
Subpath prefix: apps
Subpath: cnv
Proxy URL: https://myapp.ngrok.io/proxy
Now my manifest.json file path is https://bhavincb.myshopify.io/apps/cnv/manifest.json
Url is working fine if I'm logged in the admin panel
If I open that URL when I'm not logged in then it returns
This page isn’t working with HTTP ERROR 401
In my front store while load manifest file it is showing something like that (when logged in)
Manifest: Line: 1, column: 1, Unexpected token.
There is not any error in manifest.json
I'm using Laravel Shopify package
As of I know, I guess I'm doing something wrong with a proxy configuration.
Does anyone have a solution?
Any help will appreciate
I resolved to issue my self (ref. 2. With Proxy)
The issue with my store actually I'm using free trial and in free trial you can't disable password protection
If your password protection is enabled and you are trying to access proxy URL without logged in, in that case, Shopify won't allow accessing.
After purchase plan, it's working fine
The better recipe to follow might be this. One, you use your App to access the assets of the shop theme, and upload your manifest.json text file as an asset. That means it is accessible in Liquid, in the theme, and the shop can therefore render it and make it useful.
Second, use your App to install custom.js as a ScriptTag asset. That is the usual way to accomplish running your own JS.
The App Proxy is not really meant for use the way you are using it.

codeigniter custom 500 error

At this very moment I do not have any 500 error being thrown, but in case I ever do in the future I'm trying to customize a page so users never see that awful white screen.
I am having trouble adding said page. I have the page made and a controller that loads the page, but when I try and route the page in the route file or route it using .htaccess I'm still getting that white screen.
This is what I have tried in my route file
$route['500_override'] = 'notFoundErrorPage/serverError';
and then this is what I have tried in my .htaccess
ErrorDocument 500 http://writeyourfiction.com/NotFoundErrorPage/serverError
any help would be wonderful!
CodeIgniter does not have any custom error handlers aside from 404_override, so using one for any other HTTP code will be fruitless.
Apache has custom error pages as you've already attempted, but there are a couple of things to note that may be affecting your results:
1: A local URL begins with a /
A local URL to redirect to (if the action begins with a "/").
2: Specifying in an .htaccess may require additional configuration:
It may be used in .htaccess files if AllowOverride is set to FileInfo.
If you seek additional help, either here or elsewhere, please provide more information about your server environment: operating system, web server (e.g. Apache) and version, any relevant add-ons or modifications you may have made, etc.
It depends on the server software you are using. If you are using Apache, see here: http://httpd.apache.org/docs/2.2/custom-error.html
If you aren't using apache, google "[webserver software] custom 500 page".
If you're still having trouble, try asking on serverfault.com.

Unexpected 302 Redirects in Joomla

I locally designed my site. Then exported MySql database as Sql file and executed the scripts in the real server. Also copied the joomla directory to the server.
Now, I am getting strange 302 redirection errors in my web site, when I am accessing the home page. However, I am able to login into the admin panel. I can see all my contents available.
The redirection happens to the same page, i.e. continuous requests are issued to the index.php/en/ (checked using fiddler).
Am I missing any configurations?
Regards,
Well this is tricky without a link to the site to see the behaviour in person, but it could be that you forgot to upload a .htaccess file or set the Redirect Base or cookie path/domain in the configuration.php (if it's empty then it's probably not a problem, only if you have manually edited it).

Getting 401 error in Joomla backend when trying to login\logout or edit anything

I have a website built on Joomla.Everything seemed to be going fine when all of a sudden I am noticing the following.
When I go to the administrator login page, once I fill my details and press login, I am getting a 401.shtml page with following message -
"Not Found
The requested URL /401.shtml was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8 Server at www.shillingstudios.com Port 80"
Now as per my understanding the 401 error would mean that I do not have the authorization to visit that page or do what I am trying to do.Maybe I am not entering the correct username or password.
However,my username and password are correct.Moreover if I go back to the admin login page I find that I am logged into the administrator panel, which means that my login attempt was successful even though I was directed to 401.shtml page.
The same thing happens when I try to logout(on refresh I find that I had successfully logged out)
When I try to Save/Edit/Close an Article/Category/Section I am redirected to the same page.But in each instance I am actually able to successfully do what I was trying to do.
The only change that I made prior to this issue was installing following plug-ins:
Set Generator tag plug-in
Title Manager plug-in
I installed both plug-ins for SEO purpose from http://extensions.joomla.org/extensions/site-management/seo-a-metadata
I thought that the issue might have caused due to installing these plug-ins so I disabled them, but the problem is still there.
I am trying to setup a website for an Android game that I am developing and Joomla seemed a good option for creating my own website. However I do not have much idea about PHP or MySQL or how Apache server works.So I am not able to determine why this is happening and what can possibly fix this, so any help will be appreciated.
You could try making sure that your website URL is in the 'live site' field in the config.php file. That can sometimes help.
First you should create your custom error pages – you can use a text/HTML editor of your choice (for example Dreamweaver). Once you are ready with the pages, upload them into a subdirectory of your public_html called errors. Then open your main .htaccess file and add the following lines in it:
serve custom error pages
ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
Important settings:
Search Engine Friendly URLs: Yes
Use Apache mod_rewrite: Yes
Mod_login settings: All defaults from installation
edit:
I did rename htaccess.txt into .htaccess

Cache-manifest a login-protected page

How can I have a user authenticate and then download an offline application created specifically for them?
I'm creating a public/private key encryption system for offline use and each user needs to be able to login and "download" their encryption/decryption page (app.php) using a form. This form dumps them on their app.php page, served up with a cache-manifest file. The application needs to store their encryption and decryption keys locally to be used via Javascript. Accessing this page (app.php) without any login information should return an error page. Any updates are made via ajax to api.php and stored in localstorage, so physically downloading the page and saving it somewhere won't work (localstorage doesn't work on local files).
Here's my cache-manifest.php file:
<?php header("Content-Type: text/cache-manifest"); ?>CACHE MANIFEST
# v1.2
app.php
NETWORK:
api.php
Refreshing the application after logging in to it (via a POST request) leads to the error page being displayed instead of the browser loading the cached application.
EDIT:
I suspect the POST request has something to do with the lack of caching. Watching firebug during the initial download progress shows:
POST app.php 200 - Includes the application to be cached
GET app.php 401 - The error page - this is being cached instead
The POST request was the problem, so I had to create a unique download link for each user, then redirect them to that link. The link needs to be able to be hit at least twice from the browser, so I gave each link a timeout of 1 hour before invalidating it. The cache-manifest file also had to be modified with the unique url:
http://.../app.php?instanceid=(md5)
<?php header("Content-Type: text/cache-manifest"); ?>CACHE MANIFEST
# v1.2
app.php?instanceid=<?php echo $_GET['instanceid']; ?>
NETWORK:
api.php

Resources