400 Errors on Github Pages because of error on manifest.json being read as text/html - json

So I'm trying to serve my github pages website to https://dgatto.github.io/website/ and i keep getting these errors
Failed to load resource: the server responded with a status of 400 ()
manifest.json:1 Failed to load resource: the server responded with a status of 400 ()
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
I think that the 400's are because of the "syntax error" and I'm pretty sure that the syntax error is because of the manifest.json file being read as text/html in the network tab.
My question is, how do I change the server to accept the file as json? It's github pages so I don't really have access to the server itself.
Here's the repo if that helps: https://github.com/dgatto/website

Since you are serving your Application at https://dgatto.github.io/website/, you should define it as the homepage in your package.json file and then build.

Related

Flutter App to Web through Github pages blank screen

I have a page generated by Flutter-Web shops and it is a blank page. And I have an error in the console. This happened after uploading the build web of Flutter into GitHub Pages.
Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('https://adamtechnologynl.github.io/') with script ('https://adamtechnologynl.github.io
/flutter_service_worker.js?v=2470069411'): A bad HTTP response code (404) was received when fetching the script.
manifest.json:1 Failed to load resource: the server responded with a status of 404 ()
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
manifest.json:1 Failed to load resource: the server responded with a status of 404 ()
(index):88 Failed to load app from service worker. Falling back to plain <script> tag.
(anonymous) # (index):88
(index):47 GET https://adamtechnologynl.github.io/main.dart.js net::ERR_ABORTED 404
loadMainDartJs # (index):47
(anonymous) # (index):91
I found the solution. This happens when you have put it another directory instead of the root of the GitHub.
So my code is in "https://username.github.io/demo/book-king/belasting-web-v1/" so that last part we should append everything after "https://username.github.io/" also in the index.html. You can solve it by modifying the line (number 17 by me):
Change:
<base href="/">
into:
<base href="/demo/book-king/belasting-web-v1/">
And then you are done.
This solution works. But for me, line no 17 was not <base href="/">.
It was like this <base href="$FLUTTER_BASE_HREF">. Given that FLUTTER_BASE_HREF is a variable, it can be modified.
How?: Provide --base-href argument to flutter build like below
HostingURL : https://<github_user_name>.github.io/project_aj/demo/gh-pages/
Apart from the https://<github_user_name>.github.io should go as the value for --base-href
flutter build web --base-href=/project_aj/demo/gh-pages/

Server unable to find JSON files, but finds IMG files in the same Assets folder

I have built a portfolio site for my first Angular project and now it is ready and I'm getting an error when my Angular project attempts to locate the JSON files, but it can find and generate the image files that are in the same assets folder and I can get the JSON when I run my project locally-
main.dad43c6….bundle.js:1 ERROR
e {headers: t, status: 404, statusText: "Not Found", url: "http://megakyle83.com/assets/json/socialMedia.json", ok: false, …}
error
:
"<HTML>
↵<HEAD>
↵<TITLE>404 Not Found</TITLE>
↵<BASE href="/error_docs/"><!--[if lte IE 6]></BASE><![endif]-->
↵</HEAD>
↵<BODY>
↵<H1>Not Found</H1>
↵The requested document was not found on this server.
↵<P>
↵<HR>
↵<ADDRESS>
↵Web Server at megakyle83.com
↵</ADDRESS>
↵</BODY>
↵</HTML>
headers
:
t {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message
:
"Http failure response for http://megakyle83.com/assets/json/socialMedia.json: 404 Not Found"
name
:
"HttpErrorResponse"
ok
:
false
status
:
404
statusText
:
"Not Found"
url
:
"http://megakyle83.com/assets/json/socialMedia.json"
__proto__
:
Object
When I did my build I used the terminal command ng build --prod and then uploaded the files from the generated dist folder onto my Windows Plesk Server through GoDaddy. When I look at my assets folder on the Plesk server it shows that all the files are there under assets/json/ . I have several separate JSON files in this same folder. Could that be part of the problem?
I have all my files uploaded to my github at -https://github.com/RyanIndustries8/megakyle83
I have tried everything under the sun to make this work and I'm struggling to find anyone who knows enough about Angular to get an answers.
Look at the error message, http://megakyle83.com/assets/json/socialMedia.json 404 Not Found. I've browsed your repo and there is no such a file in assets/json/ directory moreover, there is no json directory in the assets.
I couldn't find missing socialMedia.json file in your entire repo. Ensure that this file exist under path mentioned in the error message.
The issue didn't end up being my code, instead it was a setting issue in the Plesk Server. I had to go into the Server Settings and add text/json and */json to the list of usable files. Thank you for looking at this issue.

How do I change a 500 error into a 404 error and show a custom page?

I just launched a site and when I go to a non-existing page, I get a 500 Internal Server error instead of a 404 errror.
I was thinking that this was because I didn't have a 404.html page (just a guess), but I just created a 404.html page at the root and I still get 500 errors.
What should I do to make it so that when somebody types in a bad address they get redirected to my custom 404 error page?
There is no special stuff going on with my site, just HTML, CSS and a tiny bit of javaScript. Not a Rails app, not a Wordpress site, no PHP, etc. ..just HTML files on an Apache server.
The error I get when I go to a non-existing page or directory reads like this"
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator,
webmaster#subdomain.domain.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 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
After you have the Error 500 problem solved you can create a custom 404 page by editing your .htaccess file you should have one in the root of your directory.
Open the file with a text editor and add this:
ErrorDocument 404 http://www.yourwebsite.com/404page.html
You could also create a custom Error 500 by changing the above code to suite your needs.
It's pretty self explanatory but the last part is the directory that users will be directed to after they receive a 404 error.

Chrome push notifications Device endpoint error getting 401 unauthorization error

I have a site which is trying to implement the push notifications. I have registered a project with google dev console and have the manifest.json . But from my index.html the manifest.json is giving the following errors
1)Failed to load resource: the server responded with a status of 401 (Unauthorized)
2) Manifest parsing error: Line: 1, column: 1, Unexpected token.
3) Unable to subscribe to push. DOMException: Registration failed - no sender id provided
Do i need to do anything from the google project registration side??
or should i do anything from my server side?
The site is running in .Net Server and i have mime type .json
The combination of
1) Failed to load resource: the server responded with a status of 401 (Unauthorized)"
and
2) Manifest parsing error: Line: 1, column: 1, Unexpected token.
indicates that something (HTTPAuth?) is blocking the browser's request for the manifest.json file, and it's attempting to parse whatever the server is returning as a 401 response (which won't be JSON...). If the browser can't download the manifest.json file, you can't expect anything to work after that.
Arguably the most important part of this is the "Manifest parsing error: Line: 1, column: 1, Unexpected token"
This means your manifest.json file is invalid - i.e. it's not valid JSON.
Try running it through this for more info: https://manifest-validator.appspot.com/
Once this has been fixed, it will allow Chrome to find your gcm_sender_id and fix the other two problems.

Unable to view css background-image on links

Hi guys i hope some one could help me with my problem
When i open my web page on local computer everything works just fine i can see the images, but as soon as i upload my web page to a server i dont see the images.
All file locations are correct, all file names are correct, i've checked the file permissions, css file linked properly, images set relativly to css file.
i've JSFiddled the code and it works fine: http://jsfiddle.net/ySm2x/
But it just won't show up in my web site - heres a link to my web site, the images should show under the "Coming Soon" text : http://www.voskitag.com
What can be the problem?
Here are example HTML&CSS codes i used:
HTML CODE:
<div class="social" height="40">
<a class="example" href="#" target="_blank">Example</a>
</div>
CSS Code:
.social {
text-align: center;
height: 40px;
width: auto;
}
.example {
display: inline-block;
width: 40px;
height: 40px;
background-image: url(image/url/relative/to/css/file);
text-indent: -99999px;
}
.example:hover {
background-position: 0 -40px;
}
The css you have attached is correct, so it seems the image paths are not correct (or also a permission problem). May be you must check again that those paths are correct. Firebug shows that they are problems (404 not found) with those images:
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/instagram.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/twitter.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/youtube.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/vimeo.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/googleplus.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/tumblr.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/flickr.png
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.voskitag.com/icons/pinterest.png
Are you sure that the paths to the images are correct?
I dont know how to solve your problem. But if i try to get your pictures like this
http://www.voskitag.com/icons/googleplus.png
I get the following error (maybe this helps):
[www.voskitag.com] [Mon Oct 14 22:30:52 2013] [error] [client 92.106.149.238] Premature end of script headers: f403.php
Error 500: Script Execution Failure
Description: The server encountered an internal error or misconfiguration and was unable to complete your request.
Most common reasons for returning this error message are:
• File Upload Mode
When you upload Perl, CGI scripts via FTP you should use always ASCII mode. If you get "Error 500: Script Execution Failure" you should check whether your FTP client uses ASCII mode when uploading your scripts, because if it uses BINARY mode to upload your scripts they won't work on the server. The problem caused by wrong upload mode is associated with the way different operating systems handle the "end of line" character. Unix system uses a "line-feed" (LF), Windows uses a "carriage-return" (CR) and "line-feed" (LF) pair. That's why it is very important that you set the uploading mode to ASCII.
• File Permissions
When you upload scripts via FTP the file permissions are set by default to 755. If you get "Error 500: Script Execution Failure" you should check whether your scripts have 755 permissions. Otherwise your scripts have lower level of permissions and does not support execution upon request. The octal representation of the 755 permission is equal to the following textual format: -rwxr-xr-x
Most FTP clients support the CHMOD command which is used for setting file permissions. In case you have set improper permissions to your scripts, use your FTP client and set "Read, Write, Execute" permissions for the owner, "Read, Execute" permissions for the group and everyone else.
• Script Errors
This is the third well known reason for getting "Error 500: Script Execution Failure" upon execution of your scripts. Check your scripts for any obvious syntax or programming errors to make sure your code is not broken.
Remember: When you get a "Error 500: Script Execution Failure", you should always check for any file uploading problems (ASCII/BINARY) and the executable permission settings. Once those are checked and verified, it looks like there is a syntax error or some other problem in the script.
Ok i found out what happened... For some reason when you use 'icons' folder in the root server folder it calls for problem, it leads to some weird icons list and it blocks you from using your own images, i've changed its name and walla everything works as it should of work.