Error 404 On Static Ressources Whith Parameters On Get Request
I'm doing a biomedical website with node.js and I encounter a problem: In my app.js (server file), I have these code app.get('/disease/:orphanetID', function(req, res) { var orphan
Solution 1:
Change your script path:
<scriptsrc="/static/js/DOMscripts.js"></script>
Solution 2:
To explain a lot more what's happening here, when you don't start your static resource URLs with a /
or //adomain.com/
or http://adomain.com/
, then the browser makes those URLs relative to the URL of the page.
So, if the page URL is:
http://adomain.com/disease/194
and you have a resource in the page that is specified as:
static/js/DOMscripts.js
then the browser will request an URL from the server by combining the path of the page with the relative URL of the resource so you'd get a request for:
http://adomain.com/disease/static/js/DOMscripts.js
But, your server isn't expecting that. Your server is expecting:
http://adomain.com/static/js/DOMscripts.js
So, to fix that you make your URL start with a /
. That makes it relative ONLY to the domain of the page, not the path of the page and the browser will request the URL for the resource that you expected.
Post a Comment for "Error 404 On Static Ressources Whith Parameters On Get Request"