Windows IIS wwwroot angular javascript serving up .json files not working - javascript

The website with index.html is located here
http://www.example.com/index.html
The is using angular/javascript and i'm trying to serve up fake data with .json files
locally I can do this just fine. Its just very simple javascript ... If i have any CORS issues the browser will tell me in developer tools and i just enable a CORS extension in chrome.
Problem:
Go here : http://www.example.com/index.html#/devices
Reason it seems that no data is showing is the obvious message in that it cannot locate this path
http://www.example.com/api/devices.json
What am I doing wrong?
This is where devices.json is located ... under wwwroot
/example.com/wwwroot/api

IIS is serving 404s (not found) for various reasons, to find out what the problem for your request is, without enabled detailed errors, look at the http log files, locate the request in question and find the http sub-status:
192.168.1.200 GET /devices.json - 80 ... 404 3
the number to the right of the 404 is the sub-status, in this case the 3 means: MIME type restriction. IIS by default is not configured to serve status files with a .json extension. You have add a new MIME Type mapping in IIS on the server or site level.

you may not be owner of http://www.example.com/
your IIS settings are wrong. Try to set ist reachable under http://localhost/ or http://127.0.0.1/
You may also modify your host file under system32 folder but it's not recommended.

Related

vue.js - minified css not rendering properly on Azure static site

I've deployed a static vue.js website to Azure: https://surgedemo.z16.web.core.windows.net/
The dev build renders fine in Chrome and Safari on OS X and so does the production build when I serve it from the dist directory.
However, the CSS doesn't seem to be rendered from the website. I've uploaded the files with the correct mime types.
Weirdly, when I use the Chrome Developer Tools to prettify the CSS from the static site, it then renders fine.
Any ideas?
Thanks!
Looks like mimetype is not set correctly:
$ curl https://surgedemo.z16.web.core.windows.net/css/app.dc7c3871.css -v 2>&1 | grep Content-Type
< Content-Type: text/plain
Review this on azure. From other user experiences there could be some possible points of failure, check this hint:
Alright, got it. Had to purge my Cdn Endpoint. It has cached my file
when it had it's MIME type set to "application/octeet-stream".
Basically need to set it to "text/css" and then purge the Endpoint so
it gets a fresh version from the storage Account.
source: https://social.msdn.microsoft.com/Forums/azure/en-US/a65eee29-e021-4d4d-9feb-490f5c89b7ea/troubles-with-azure-cdn-and-css-files?forum=azurecdn

Back4App angular hosting

When Uploading a compiled angular-6 app to back4app and following their Docs
https://www.back4app.com/docs/javascript/angular-template
I always get Error (403 - Forbidden) in the Chrome console although I already added the Keys required to connect to the service in the environment.ts File
Double-check that the files are in the public folder because the 403 error is related to the lack of permission. Another point are the reserved words from Parse, that can affect this, example: /login.

NGINX+Bolt CMS - static content calls returning 404 errors

I decided to try out Bolt CMS on my web server, which has happily run several Wordpress sites for a few months now through PHP-FPM.
The site's front end works apparently fine, but the administration section of the site has problems. Every call to static content -- JS, CSS and image files -- results in a 404 (not found) error. What's more, when I look at the NGINX error logs I see that the server tries to access the files from this location:
/usr/share/nginx/
I don't use that directory anywhere in my nginx or bolt configurations! I've done "grep -R '/usr/share' ." in my nginx and bolt configuration directories, with no results returned.
Has anyone had this problem before? where is the /usr/share/nginx/ reference coming from?
Under distributions like RHEL/CentOS (probably others), /usr/share/nginx/ is the location of the default Nginx files. You can grep -R /etc/nginx and that will point you to where.
The usual problem that I encounter (create for my own misery) is that I will create the Nginx virtual host file as something like /etc/nginx/conf.d/example.com instead of /etc/nginx/conf.d/example.com.conf (note the .conf)

Production Node Application Can't Find SVG Files

In my local development application the svg files show up just fine with the following code (The curly brackets embed Angular.js variables):
<img ng-src="img/servant_{{servant.personality}}.svg" draggable="false">
But when deployed on Heroku, the SVG files result in a 404:
Failed to load resource: the server responded with a status of 404 (Not Found)
The Angular variable is working on the Production site and the image addresses are accurate. So, that's not the problem.
Instead, I think my Node/Express application might not be able to serve SVG files. Perhaps it's a Heroku issue? FYI I'm using the MEAN stack.
Here is the configuration of my public folder:
//Setting the fav icon and static folder
app.use(express.static(config.root + '/public'));
The images are in
public/img
Any thoughts?
Ensure you have the correct mime-type configured to serve SVG files. Some servers simply respond with a 404 if the mime for the requested file type is not set.
image/svg+xml

IDEA Failed to load resource

I want to debug my html + javascript site in IDEA and Chrome browser.
When I press 'debug' in console i got:
Failed to load resource file:///C:/js/angular.min.js
As I undestand, I need to set root path of my web site in properties. But where this option?
Such urls (site root-relative, the ones starting with slash) can't be properly resolved when opening file locally (using file:// protocol) - the browser will search for these files in your system root (C:/). You need using remote javascript debug configuration (access your html using the web server url rather than local path) to make this work. See http://wiki.jetbrains.net/intellij/Debugging_JavaScript_with_IntelliJ_IDEA#Remote_debugging for more information on remote javascript debugging in Idea
Note that Idea 12 supports so-called built-in webserver (http://confluence.jetbrains.com/display/WI/built-in+web+server), so you can test your code without installing a web server.
Instead of accessing from local file system try to access your html + javascript application from a web server by putting those appication files in web server.
Install XAMPP or WAMP in your system and copy your application into the htdocs folder to run that application locally.Also edit the files using IDEA from there.So,you can parallely edit using IEDA and run using XAMPP.
http://www.apachefriends.org/f/viewtopic.php?t=14173.

Categories

Resources