@Wael Kodmani edited Serverdev in webpack files like the following command:
Update:
devServer: {
allowedHosts: '<azure-name-app>.azurewebsites.net',
}
--
Apologies for the delayed response.
If you haven't done, you may modify the code in the code about listening.
const express = require('express')
const app = express()
const port = process.env.PORT || 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
There is discussion on similar SO thread, you may take a look the approaches outlined
Based on my understanding of your issue, depending on your web framework.
Just to highlight , listen binds to the local host, localhost, interface by default (127.0.0.1 or ::1, depending on the operating system configuration). If you are running Fastify ( as an example) in a container, you may need to bind to 0.0.0.0. Be careful when deciding to listen on all interfaces; it comes with inherent security risks. See the documentation for more information.
Inside Docker, you should mention explicitly '0.0.0.0'. By default fastify is listening only the localhost 127.0.0.1 interface. To listen on all available IPv4 interfaces you should be modified to listen on 0.0.0.0 like so I change it to the following
Once Oryx will also execute npm run build, you can take advantage and set up PM2 to serve the build folder with pm2 serve /home/site/wwwroot/build --no-daemon
see the article section Custom Startup Commands
Ref:
Configure a Node.js app for Azure App Service
Kindly let us know, I'll follow-up with you further.
If my answer helped (pointed, you in the right direction) > please click Accept Answer - it will benefit the community/users to find the answer quickly.