-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
5.0.0
Plugin version
No response
Node.js version
20.17.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Sequoia
Description
This simple server:
import {fastify} from 'fastify';
const server = fastify({
logger: true
});
server.get('/', (request, reply) => {
console.log('Hostname: "' + request.hostname + '"');
reply.send('Hello World!');
});
server.listen({port: 3040}, (err, address) => {
console.log(`Server listening at ${address}`);
});
Prints:
Server listening at http://[::1]:3040
{"level":30,"time":1730060215348,"pid":34830,"hostname":"<redacted>","reqId":"req-1","req":{"method":"GET","url":"/","host":"[::1]:3040","remoteAddress":"::1","remotePort":63860},"msg":"incoming request"}
Hostname: "["
We can see that the hostname resolved to [ which is wrong.
Link to code that reproduces the bug
No response
Expected Behavior
The hostname should be [::1].
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels