title: java.lang.Exception: Host is not set (running a JakartaEE app on Payara micro, behind nginx)
body: <p>This error trace is polluting my logs and I can't find on SA or else what is causing it:</p>
  <pre><code>[2022-01-11T04:15:00.144+0100] [] [[1;91mSEVERE[0m] [AS-WEB-CORE-00037] [[1;94mjavax.enterprise.web.core[0m] [tid: _ThreadID=27428 _ThreadName=http-thread-pool::http-listener(331)] [timeMillis: 1641870900144] [levelValue: 1000] [[
    An exception or error occurred in the container during the request processing
  java.lang.Exception: Host is not set
      at org.glassfish.grizzly.http.server.util.Mapper.map(Mapper.java:865)
      at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:496)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:309)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
      at java.base/java.lang.Thread.run(Thread.java:829)
  ]]
  </code></pre>
  <p>This is for a JakartaEE app with JSF 2.3 (Faces) running on Payara micro 5.2021.2. If this is of any relevance, here are the parts of the nginx config that redirect the traffic to the app:</p>
  <pre><code>upstream payara {
      least_conn;
  
      server localhost:8080 max_fails=3 fail_timeout=5s;
      server localhost:8181 max_fails=3 fail_timeout=5s;
  }
  
      location /jsf-app-1.0-SNAPSHOT/ {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
              proxy_set_header X-Forwarded-Proto https;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection &quot;upgrade&quot;;
              proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment;
              proxy_no_cache $http_pragma     $http_authorization;
              proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
              proxy_cache_bypass $http_pragma $http_authorization;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $host:$server_port;
              add_header Access-Control-Allow-Origin *;
              proxy_set_header Access-Control-Allow-Origin *;
              proxy_pass http://payara$request_uri;
      }
      
      location / {
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
          proxy_set_header X-Forwarded-Proto https;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection &quot;upgrade&quot;;
          proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment;
              proxy_no_cache $http_pragma     $http_authorization;
              proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
              proxy_cache_bypass $http_pragma $http_authorization;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header Host $host:$server_port;
              add_header Access-Control-Allow-Origin *;
              proxy_set_header Access-Control-Allow-Origin *;
              proxy_pass http://payara$request_uri$is_args$args;
  
     }
  </code></pre>