I have a static resource image on my static server (http://static.coderichard.com/) which I want to use for a Journal Skin which I'm designing on DeviantArt. But when the image is loaded, I got a 403 Forbidden error.
The image is loaded through CSS like so:
background-image: url('http://static.coderichard.com/img/intrvi-journal-skin-bg.png');
When I tried the exact same thing in JSFiddle, it worked fine. I can also load the image through the browser.
Checking error logs yielded no information and the directory the image is in has 755 permission.
Why am I getting this error and how can I fix it?
I read the following thread, having the same issue as me: http://ubuntuforums.org/showthread.php?t=2167595
The solution was to disable the hotlink protection via .htaccess, but I don't have a .htaccess file there so it makes no sense to try that.
My server is CloudFlare protected and uses Hotlink protection. What I did to fix it was add a directory called hotlink-ok and I put all my resources there which were okay to hotlink.
Try setting a referer with a commannd-line client. If it immediately 403s again, find where your "hotlink protection" is implemented.
Related
I migrated a wordpress website to a new host, i made some edit to the wordpress page and tried to save the page. It was giving me the error below when i used google chrome console to debug the issue
“Failed to load resource: the server responded with a status of 403 ()”
with the route “wp-admin/admin-ajax.php:1”
After trying all the solutions outlined below, so i was able to fix it by using the Solution 6.
403 forbidden means that your browser isn’t able to load the scripts up because your server isn’t allowing it. This is a hard one to solve. Because anything could be blocking the server. Hence 403 forbidden error is very vague, the error log may give you clue.
Solution 1 – Most likely this is a server permissions/ownership issue. If its a permission issue, it may tell you which file has incorrect permissions, so ask your host what’s going on. If you are using cPanel, the following tutorial has more information about the error log in cPane: How to view cPanel Error logs
Solution 2 – If the problem is file permissions, you can follow the steps in the below article to learn how to modify your file permissions: How to change file permissions within cPanel https://codex.wordpress.org/Changing_File_Permissions
Solution 3 – Another possible cause could be a corrupt .htaccess file. Also check your .htaccess files for anything strange.
Solution 4 – make sure your server settings are not overriding the .htaccess file.
Solution 5 – Another possible cause could be changes to the server settings (accidental or otherwise). Check with your hosting provider.
Solution 6 -Last but not the least solution, disable mod security for that domain.
Does anyone know what this error message on WordPress means?
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
I couldn't find any errors that I can think of.
This happened when I tried to upload an MP4 file that is about 200MB in size. I have set my WordPress to accept MP4 of up to 5GB so that shouldn't be a problem, I am using WordPress Multisite installation on Ubuntu 16.04.
In my php.ini I have set the max upload size to 50GB and max post size to 50GB too and I also set the max memory to 1GB. But it just kept sending me that error and I have no idea where to look. All it says was an unexpected response and I have no idea what response that might be.
I can upload MP4 with a size of 27MB with no problem, I know the default WordPress setting is 20MB so I'm pretty sure the size isn't the problem.
I have also check that the file wasn't corrupted, it was working fine on my computer as well as YouTube.
I tried restarting PHP (PHP-FPM) and Apache2 but it doesn't seem to be working.
Does anyone has an idea of what is going on? Thanks 🙌
I think my answer is too late. but I would like to post a solution for anyone still looking for a solution for this issue on WordPress running on Nginx.
You should add the following directive to set the maximum allowed size in HTTP(server/location) section.
client_max_body_size 10M;
I have understood why this WordPress error occurs "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.", atleast in my case :D
Issue:
If you can upload any other file except this specific one, then it is an issue with the file's size.
Solution:
In my case everything was correct - upload limits, post_max_size, memory_limit etc but if you are using NGINX, the possible issue is with client_max_body_size
Step 1: In your nginx.conf file, increase the value of "client_max_body_size" to 256M (or more as needed).
Step 2: Restart nginx.
Now you can reload the media library and try uploading the file again. To be on the safe side, rename your file before uploading.
The mentioned error is generic, it may refer to more than one possibility, so check this out:
Maybe you enabled Cloudflare with basic plan in your hosting, if so, Cloudflare limits the upload to 100 MB.
Maybe you mixed content on your website, with some pages refering to http and other pages refering to https. If so, please check the link: https://websitesetup.org/http-to-https-wordpress.
Maybe you installed security plugin.
Deactivating "All in one WP security" did the trick. You can re-enable it after the upload.
I had the same issue and tried all of the solutions above but had no luck. I ended up using this plugin and it worked automatically. No idea why bc I didn't increase the max upload size or anything. I noticed in their reviews someone else had the same issue. So hopefully it'll help someone else out there!
https://wordpress.org/support/plugin/tuxedo-big-file-uploads/reviews/
This appears to be an issue with the newer versions of WordPress themselves, rather than anything server side.
It appears to be a known issue to WordPress developers that is being investigated (eg: https://core.trac.wordpress.org/ticket/48778)
I faced the same error and finally it was fixed.
you may installed maximum upload plugins and its configuration is different than your host configuration, for example: if you set max upload from the plugin to 512M and your host configuration is 64, your browser will show your maximum upload as 512M not 64, but later after uploading the unexpected error will display.
the solution : remove the max upload plugin as it my conflict with configuration.
and if you host your website with shared server service, call the support to update the max upload size for you
I had the same problem a number of times and again today. My client was trying to upload PDF's to the media library that were not large and he was getting the error message "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" The files were mostly around 1.6mb. Some worked, some didn't. They would upload but the preview of the file would not show in the media library. I tried using the Browser upload method also. Same result only once the upload completed we would get a 404 page not found error.
Ultimately I figured out the issue was an unsupported font used in the PDF files called ZeitungPro-Regular. When I opened the file in Adobe Acrobat DC Adobe showed the error message "Unrecognized font". I switched over to edit mode and changed the font to Arial Narrow as a test. Saved it and uploaded it and it worked! The issue was not with the server or the site set up, the issue was that WordPress could not process that font after uploading the file. If you are getting the "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page" check the file you are uploading carefully.
For people using the Wordfence security plugin, I had the same issue combined to other listed here. Max upload size, nginx client_max_body_size, it finally worked but only for admins.
Then I had to switch the Wordfence firewall in learning mode and let users upload their large file, and turn the firewall back to production mode. Long calls to admin ajax were blocked.
Hope this helps.
I came looking for a solution to this same problem. What caused the problem was an apostrophe in the file name. Simply removing that allowed the same file to upload without an issue.
I also faced the same error. I just deactivated the wordfence security plugin and now it's work fine. Hope help someone.
I had the same problem on Windows when I upgraded PHP to a newer version.
The problem was that the /logs and /tmp folders did not exist in the new PHP folder as it was set to c:\php\logs and c:\php\tmp in the php.ini file.
I've just migrated a website live, and some images are coming up with a strange error:
"Error occured while calculating source (passed through env): No image roots defined in config."
Example URL: https://piktochart.com/wp-content/uploads/2019/07/Template-09-Lead-gen-handbook.jpg
Anyone seen this before?
This is only happening on some of the images. I cannot find the cause, I've disabled/re-enabled caching.
I've downloaded the images from the server and they look fine.
I have faced this issue on my own site,I managed, as well.
You can use a plugin that manipulates images, such as WebP Express? Check your htaccess file for rewrite rules involve jpg or png files. I used the above plugin, but it was disabled and the htaccess rules were left in place; trying to redirect images to a page that it couldn’t handle.
For me it was caused by Webp Express, the plugin also gave a notice: It seems your server setup does not support headers in .htaccess. You should either fix this (install mod_headers) or deactivate the "Enable direct redirection to existing converted images?" option. Otherwise the Vary:Accept header will not be added and this can result in problems for users behind proxy servers (ie used in larger companies)
Setting the Operation mode to "No conversion" solved my issue.
I'm testing a WordPress plugin that uses TimThumb.
On one server (GoDaddy) I'm getting a 400 (Bad Request) error whenever I request the timthumb.php file from the plugins directory. However, an identical request on a different server works just fine.
/wp-content/plugins/wp-vimeo/timthumb.php
I'm puzzled. I can request other files in the same directory just fine. Could it be a permissions issue? I would have expected a 403 if that were the case.
For Windows hosting add IUSR (or whatever account your app pool is running) to wp-content with read/write.
For me it was because my images were to be resized.
If you copy paste the timthumb url int the browser and receive the error that the image size is to big. I had to either change the file size of the images or change the timthumb's setting to handle bigger images.
This line in the timthumb.php file:
define ('MAX_FILE_SIZE', 3000000); // file size limit to prevent possible DOS attacks (roughly 3 megabytes)
I fixed it by moving my site from a Window Server to a Linux Server. Still on godaddy. [a]
Inside timthumb.php you'll find this line:
header ($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
This is triggered whenever there's an error: inaccessible cache, required query string variables missing, etc. I have found that link checkers like Google Webmaster Tools and Integrity sometimes remove the query string and check the validity of the root files. Of course without the query string timthumb.php will then return the 400 error.
To tidy this up I comment out the above line.
These answers don't seem to address the issue directly. You can paste the URL in of the timthumb call. In your browser you should get diagnostic error form timthumb. Usually it is because there is not a writable cache directory for timthumb to use to make the Image it serves.
I am getting this error message while trying to access a wordpress blog which is installed in a directory. Is this due to .htaccess or something? Any help is appreciated.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#xxxxx.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at xxxx.com Port 80'
This is almost always a problem with your Apache configuration. Errors originating in PHP won’t trigger the Apache 5xx handler, which is what you’re seeing.
Unfortunately, without more information, your problem is impossible to diagnose. I’d recommend that you:
Check the logs. First thing! It should give you a better idea where your problem is.
Stop and restart Apache. If there is a problem with permissions on something Apache needs write access to (logs), it could completely fail to start. This should give you the proper motivation to fix the problem, particularly if there are other VirtualHosts on that Apache.
Move your .htaccess file(s) somewhere else. If Apache works, you know it’s a problem with that file.
It sounds like you're getting some sort of PHP error but PHP isn't set to display errors. You'll want to check your Apache logs for detailed error info.
The mostly likely culprit is that you're missing some prerequisite for running WordPress, although all you should really need is Apache, MySQL, & mod_rewrite.
I was able to fix it by adding the following line to my .htaccess file:
php_value memory_limit 128M
Russ
This is happening to me RIGHT NOW.
As to from what I know, my hosting providers did a DNS change and so I'm waiting for the DNS to propagate, it's been like three hours and still zero.
Blog is showing ok, apache is up and working, I just can't get access into the WP Admin area.
If it does get fixed by tomorrow, I'll reply here so it can be of help for others.
Edit: I just fixed my problem.
In my case it was determined that the Fast Contact Form plug-in was creating the problem. I modified the folder name from si-contact-form to si-contact-form-hold then I regained WP Admin access.
After that I created a php.ini file with this string inside 'memory=64MB' and saved that into the wp-admin folder.
Manually deleted the si-contact-form-hold (to avoid possible corrupted files) and reinstalled the Fast Contact Form.
All my settings were already there and everything is back up and running good!
Hope this helps.
Look at http://zemalf.com/1470/wordpress-htaccess-the-definite-guide/, and look for the paragraph which says something like "Good and default .htaccess looks like this...."
My issue was a little bit different. I had an .htaccess file inside the wp-admin directory. I deleted the .htaccess inside of wp-admin and that fixed my problems.
Unfortunately it could be anything. Do static pages on the site work properly.
Have you checked the server logs.
I think it is likely to do with php. If static pages are there then possibly your config for wordpress is incorrectly configured or files missing.
Has php be working? Did the blog work and then stop? Did you get through the install process?
Check wordpress files ownership for the user are correct or not.
In linux ls -laZ command will display the ownership.
For setting the ownership for a folder use this command
chown -R username:username /user/username/public_html/
An HTTP 500 error could be caused by a great many things. Have you changed your .htaccess file recently? If you try to use a .htaccess feature that is disabled on your host, that is one possible cause.
Some more points
Blog has been running successfully. Just observed this problem since yesterday.
Blog is in a directory so it works something like this www.xyz.com/blog. Apparently www.xyz.com is working perfectly.
Update on logs
Getting these two errors in the logs:
File does not exist: /home/directory/public_html/500.shtml
/home/sub-directory/public_html/sub-directory/.htaccess: RewriteCond: bad argument line '%{REQUEST_FILENAME}!-f'
/home/directory/public_html/sub-directory/.htaccess: # without matching # section
How do I restart apache on cpanel ?
memory = 64MB;
The above line inside a php.ini file uploaded to the wp-admin folder solved my problem. I was not being able to log into the dashboard either through /wp-admin or /wp-login.php, and was getting a HTTP server error 500.
There can be multiple causes for this, I just solved mine, after 2-3 hours of going crazy.
I had another WP instance in a subdirectory inside the main WP instance (in the root folder).
Have checked / deleted .htaccess
deleted plugin folder
In the end, it was to do with the permission of the subfolder in which second instance was running. It was originally 775 (write permission for group), I had to change it to 755 (no write permission for group) and this finally fixed it, like magic.
This is of course just one of possible the answers to your question, I wanted to write it down though as I didn't find it explicitly written anywhere so it might save others some time.