javascript - Not getting the right URL path - URL path is: /favicon.ico -
im using following code , when run path in browser first time http://localhost:9000/aaaa/bbbb/cccc
in first time im getting /aaaa/bbb/cccc in second got url path is: /favicon.ico
what can overcome issue?
url = require('url'); .... http.createserver(function(req, res) { var hostname = req.headers.host.split(":")[0]; var pathname = url.parse(req.url).pathname; console.log("host name: " + hostname); console.log("url path is: " + pathname);
- if have nginx in front of node, add
location = /favicon.ico { access_log off; log_not_found off; }conf. serve node
if (req.url === '/favicon.ico') { res.writehead(200, {'content-type': 'image/x-icon'} ); return res.end(); }go linking favicon html quentin suggested.
Comments
Post a Comment