403 Forbidden ONLY on javascript folder - web-services

I've been trying to trouble shoot this for 3 days and still can't figure it out after going through many other SO questions.
I'm setting up a DigitalOcean VPS using Apache 2.4.7. Setup for 2.4 is different from previous versions, so that may be part of my issue.
PROBLEM
I'm migrating from shared hosting, and trying to test my site on the new DO VPS. When I go to my new IP address, the site loads, but the following resources get a 404 error:
<link href="/javascript/jquery-ui-1.9.2.custom/css/smoothness/jquery-ui-1.9.2.custom.css" rel="stylesheet">
<script src="/javascript/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"></script>
<script src="/javascript/dialog/alert_text.js"></script>
Resources in other folders are loading fine; for example, this stylesheet loads without issue:
<link rel="stylesheet" type="text/css" href="/styles/main_style.css">
I tracked down the issue to a 403 forbidden error on my /javascript directory. This directory is owned by the same owner/group and has the same permissions (755) as every other directory in my web root. But for some reason I cannot access /javascript from my web browser.
WHAT I'VE TRIED
The files do exist on the new server in that location. I've checked that the folder is correct, and that there aren't any strange capitalizations. Everything is working fine on the old server, and all I've done is copy and paste the directory structure to the new server.
There are no .htaccess files on the server. And the server wouldn't care if there were, because Alow Override None is set.
I've changed my apache2.conf back to the default state to make sure there are no strange <Directory> directives.
I added a <Directory> for the /javascript folder and did Require all granted.
I changed permissions on the /javascript folder to chmod 777 with no effect, then changed back to chmod 755.
I'm restarting the web server after each change, but nothing has any effect. I always get a 403 forbidden error on the /javascript directory, even though the owners and permissions are the exact same as every other directory in my web root.
Is there some way to get more info on the 403 error? Some way to find out why it's not allowing access?
Final note
One thing to note is that I haven't pointed my DNS to DigitalOcean yet since I'm still testing. So the client browser is loading from MY.IP.ADR.ESS/javascript/... rather than MYDOMAINNAME/javascript/.... I can't imagine that would matter, but thought I would mention it anyway.

I found the issue, and it's a known problem: Ubuntu BUG.
The problem was that the folder's name was "javascript", and the fix was simply renaming my /javascript folder to /java-script (or anything OTHER than /javascript).
Basically if you have the javascript-common package installed, it generates the following alias:
Alias /javascript /usr/share/javascript
So my WEBROOT/javascript folder was being redirected to /usr/share/javascript, giving the 403 error.
Hope this helps save someone else a few days of troubleshooting!

Related

AWS S3 / Cloudfront deployment - certain paths aren't updating on static website

I'm fairly new to AWS and web dev - I have a simple static website at https://iveyfintechclub.ca
I recently refactored the code and made some changes to the project organization. I basically wiped the S3 bucket and reuploaded all new files and folders.
On CloudFront, I have object caching set to use origin cache headers:
my CloudFront distribution behavior config
I also did an invalidation with /*.
On S3, I've set the metadata Cache-Control to max-age=0 for all files.
Two problems are still eluding me:
The old bucket had a blank index.html which redirected to a
nested HTML file. The new bucket has index.html as the landing page.
When I attempt to visit the root URL, I get a 404 error as it still
attempts to reach the old nested HTML path. This doesn't happen in incognito mode (browser cache issue).
2. On the new landing page, I have a script file which is getting a 404
error as its looking for the file on its old path. Inspecting the HTML shows that the new path is in the client. This is happening in incognito mode too. All other resources are loading properly with
new paths, just this one is failing.
I'm wondering if I just have to wait longer or if I'm still missing a configuration.

Subdirectory pages not found static site hosted on Google Cloud Storage Bucket

I'm setting up a static site on a Google Cloud Storage Bucket with Loadbalancer. The site gets generated with Gridsome and then the dist folder gets saved in the bucket.
I have set the index and error with gsutil like in the [documentation]: https://cloud.google.com/storage/docs/gsutil/commands/web
Now I am facing a problem with how every url for accessing subdirectories gets redirected to dir/index.html. This is desired behavior, the dir/index.html page even exists in the bucket. But I still get a 404 - not found.
If I do a curl to the url subdir/index.html I get the HTML
I do not know exactly how you are testing your subfolder but I think this link can help you with your issue Error 404 when loading subfolder on GCS. In addition, you maybe must to take a look here How subdirectories work.
Based on How subdirectories work on GCS, when browser request URL http://www.example.com/dir it will be redirect (301) to The object http://www.example.com/dir/index.html on content served.
My assumption is there is no route http://www.example.com/dir/index.html on Vue (vue-router). So it will be throw to Not Found 404 page.
The simple solution is try to change all subdirectories link from
http://www.example.com/dir, http://www.example.com/about etc, to
http://www.example.com/dir/, http://www.example.com/about/
It will not redirect to 404 page when you request subdirectories url or reload the browser. But we all know that it's not best practices.

Vhosts domain 503 unavailable after changing user permisson on Ubuntu (AWS Lightsail)

At the recent time, I was trying to setup an SFTP on my AWS lightsail - Ubuntu Plesk instance. Once I noticed my current user doesn't have access to vhosts/example.com/httpdocs folder, I tried to give the current user access rights with giving this command on ssh :
- sudo chown -R (my-username)
after that I sucessfully got the access to desired folder on my sftp client.
But unfortunately, there was something wrong on its domain when I accessed in browser with 503 Error. And also the file manager in Plesk returned an Error 13.
after recover the the user permission with this command :
- /usr/local/psa/bin/repair --restore-vhosts-permissions
the file manager was back to normal, but not the website domain : which still has 503 error.
any idea what's wrong with that? I believe this has to be user permission problem, but couldn't find anywhere else to fix it. not to mention, I am newbie on Ubuntu server.
hope to find some decent answer here :) Thanks and have a good day!
So, After few months of deploying VPS in AWS Lightsail with Plesk, There are few things that could lead this problem happen.
1. Permission is not enough for the directory, make sure you have at least 755 for the root or desired directory you want to access.
2. The PHP version and Nginx/Apache Configuration can also be the issue. In some cases, The current Plesk Onyx delivered along with Nginx and Apache, I always choose "FastCGI application served by Apache" and it is often solve the problem. This setting can be found "websites & Domains > PHP Settings"
3. Missing Index.php or Index.html or reference file for indexing. So the server is confused to interpret which file should be access first.
I hope this solve someone else problem. Discussion can be continued on the comment. :) Have a good day!

Youtube not able to play on my django-heroku app. Giving me a mixed content error message

I tried to view youtube videos on my app and it didn't work. I checked the console and got this error message
Mixed Content: The page at'https://hispanicheights.herokuapp.com/blog/youtube-video/'
was loaded over HTTPS,but requested an insecure script
'http://content.jwplatform.com/libraries/WQWJdvRx.js'.
This request has been blocked; the content must be served over HTTPS.
Is there a way around this or is this just the situation until I get a paid account with a domain?
This has nothing to do with Heroku, paid plans or not. It is simply that you are linking to an http resource inside a page that is served by https; since that potentially side steps the man-in-the-middle protection that https gives you, modern browsers forbid it.
The solution is to serve all your dependent scripts via https as well.

Coldfusion 8: Firefox can't establish a connection to the server at 127.0.0.1:8500

I installed Coldfusion 8 trial version on my system (XP Professional sp3).
I created an Folder in the “C:/Coldfusion8/wwwroot” called “buildProject” containing an Index.cfm and some other .cfm files.
But I am unable to access the Neither my project files or CFIDE/Administrator
I tried the following URLS
http://localhost:8500/wwwroot/buildProject/
http://localhost:8500/CFIDE/administrator/index.cfm
http:// 127.0.0.1:8500/wwwroot/buildProject/
http:// 127.0.0.1:8500/CFIDE/administrator/index.cfm
http://localhost /wwwroot/buildProject/index.cfm
http://localhost /CFIDE/administrator/index.cfm
http://localhost /wwwroot/buildProject/
http://localhost /CFIDE/administrator/index.cfm
Firefox can't establish a connection to the server at 127.0.0.1:8500.
* The site could be temporarily unavailable or too busy. Try again in a few
moments.
* If you are unable to load any pages, check your computer's network
connection.
* If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.
• I cleared the browsing “History” from both IE and FF.
• I have restarted the CF server in the Control Panel >Administrative Tools > Services
• Even restarted the IIS
Getting the same error.
Further I was trying to access IE/FF via CFbuilder But still I am getting the error
“The connection was refused when attempting to contact [URL].”
If you connected Coldfusion to IIS, then you probably need to connect on port 80. Which you did try, but if you connected Coldfusion to IIS, then the document root is IIS's document root, not the document root you created your new directory in.
I believe the document root for IIS on XP is c:\inetpub\wwwroot.
So, try putting a test.cfm file in there that just contains "hello world" or something, and see if you can request it from there.
Hopefully you installed IIS first and were happy it was working before installing CF.
Try connecting to your IIS on http://localhost
You should get the default IIS .htm landing page , probably index.html or something, so at least you know IIS is working fine.
If you then try http://localhost/nosuchpage.htm you will see a 403 error (as long as you didnt specify to allow directory browsing). In the standard IIS error page you should be able to see
Physical Path D:\inetpub\wwwroot
or wherever IIS thinks your web root is. When you then install CF to use IIS (rather than standalone) it will use this path as your web root.
Rename your index.html file as index.cfm and connect to it on
http://localhost:8500/index.cfm
If vanilla html pages are working from the directory but .cfm pages are not then you probably need an CFIDE mapping (I think one quick workaround is simply to copy your CFIDE folder and drop it into web root).
What happens if you try typing this in as a url:
http://{your i.p. address}:8500/CFIDE/administrator/index.cfm
I bet it works