Repository: next.js
Issue: On demand ISR works fine  in local machine but fails when deployed to iisnode running in azure windows webaps
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in Next.js canary release

### Provide environment information

 Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Enterprise
    Binaries:
      Node: 16.13.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.1.7-canary.23
      react: 17.0.2
      react-dom: 17.0.2

### What browser are you using? (if relevant)

chrome

### How are you deploying your application? (if relevant)

next start

### Describe the Bug

On demand ISR works on Local machine . 
But when deployed to windows webapp iisnode revalidate fails
with Error revalidating

### Expected Behavior

Revalidate should work fine

### To Reproduce

// pages/api/revalidate.js
export default async function handler(req, res) {
    // Check for secret to confirm this is a valid request
    if (req.query.secret !== process.env.MY_SECRET_TOKEN) {
        return res.status(401).json({ message: "Invalid token" })
    }

    try {
        await res.unstable_revalidate("/en-us/gentiane-valiquette")
        return res.json({ revalidated: true })
    } catch (err) {
        // If there was an error, Next.js will continue
        // to show the last successfully generated page
        return res.status(500).send("Error revalidating")
    }
}


//package.json

"scripts": {
    "start": "node server.js",
    "dev": "next dev",
    "build": "next build",
    "postbuild": "node -e \"require('./config/generators').generateSSRWebConfig()\"",
    "export": "npm run check-quality && next build && next export",
    "postexport": "babel-node -e 'require(\"./config/generators\").generateSitemap()' && babel-node -e 'require(\"./config/generators\").generateSSGWebConfig()'",
    "preview": "npm --production=false install && next build",
    "setup-preview": "npm --production=false install && next build",
    "dev:debug": "cross-env NODE_OPTIONS='--inspect' next dev",
    "lint": "npm run lint:js && npm run lint:styles && next lint",
    "lint:fix": "npm run lint:js-fix && npm run lint:styles-fix && next lint",
    "lint:js": "eslint \"./src/pages/*.js\" \"./src/components/**/*.js\" \"./src/adapters/**/*.js\"",
    "lint:js-fix": "eslint \"./src/pages/*.js\" \"./src/components/**/*.js\" \"./src/adapters/**/*.js\" \"./src/store/*.js\" --fix",
    "lint:styles": "stylelint \"src/components/**/*.styles.js\"  \"src/styles/**/*.css\"",
    "lint:styles-fix": "stylelint \"src/components/**/*.styles.js\"  \"src/styles/**/*.css\" --fix",
    "eslint-report": "eslint --ext .jsx,.js \"./src/components/**\" -o report.json -f json",
    
    
    Server.js
    --------------------
    // server.js
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'
const hostname = 'localhost'
const port = process.env.PORT || "3000"
// when using middleware `hostname` and `port` must be provided below
const app = next({ dev, hostname, port })
const handle = app.getRequestHandler()

app.prepare().then(() => {
  createServer(async (req, res) => {
    try {
      // Be sure to pass `true` as the second argument to `url.parse`.
      // This tells it to parse the query portion of the URL.
      const parsedUrl = parse(req.url, true)
      const { pathname, query } = parsedUrl

      if (pathname === '/a') {
        await app.render(req, res, '/a', query)
      } else if (pathname === '/b') {
        await app.render(req, res, '/b', query)
      } else {
        await handle(req, res, parsedUrl)
      }
    } catch (err) {
      console.error('Error occurred handling', req.url, err)
      res.statusCode = 500
      res.end('internal server error')
    }
  }).listen(port, (err) => {
    if (err) throw err
    console.log(`> Ready on http://${hostname}:${port}`)
  })
})