Prerequisites
Fastify version
9.0.0
Plugin version
No response
Node.js version
v16.10.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
CentOS Linux 7 (Core)
Description
When the host of listen is set to '0.0.0.0', the host obtained by the middleware of nextjs is empty, which causes the nextjs middleware to report an error
Steps to Reproduce
// import next from 'next';
import fastifyFactory from 'fastify';
import FastifyNextJS from '@fastify/nextjs';
// import {parse} from 'url';
// import { ParsedUrlQuery } from 'querystring';
// import { NextUrlWithParsedQuery } from 'next/dist/server/request-meta';
const port = parseInt(process.env.PORT as string, 10) || 8000;
const dev = process.env.NODE_ENV !== 'production';
// const app = next({ dev })
const fastify = fastifyFactory({logger: false, pluginTimeout: dev ? 120_000 : undefined});
fastify
.register(FastifyNextJS)
.after(() => {
fastify.next('/*', (app, req, reply) => {
return app.getRequestHandler()(req.raw, reply.raw).then(() => {
reply.hijack();
})
})
});
const start = async () => {
try {
await fastify.listen({
port,
host: '0.0.0.0',
exclusive: false,
readableAll: false,
writableAll: false,
ipv6Only: false
});
console.log(`server start at port: ${port}`);
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
};
start();
Expected Behavior
No response
Prerequisites
Fastify version
9.0.0
Plugin version
No response
Node.js version
v16.10.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
CentOS Linux 7 (Core)
Description
When the host of listen is set to '0.0.0.0', the host obtained by the middleware of nextjs is empty, which causes the nextjs middleware to report an error
Steps to Reproduce
Expected Behavior
No response