If "rudder agent inventory" gives an error, that means the inventory could not be generated or sent. You can run it again with the "-i" option to see more details about the problem (like the curl error message or the missing field in the inventory. If it succeeds, that means the problem stands between the node and the web application, or in the web application itself :

Check that your node IP is in an allowed network of its policy server, and that you node can contact its policy server on port tcp/443 (for example with nc -v IP_OR_HOST 443).

If you have other VirtualHosts on the Rudder policy server, check that Rudder VirtualHost (on port 443 and 80) is the default when the a request does not match an existing ServerName (as we have no way to determine a correct ServerName).

As the inventory has been correctly sent, it has probably been refused by the server. See the webapp logs in /var/log/rudder/webapp/TODAY_stderrout.log for details. In particular, see this other entry about inventory signature errors.

If you are using the Squid proxy between the node and the server, the workaround might simply be to add this entry to your
/etc/squid/squid.conf: ignore_expect_100 on, it will
make Squid more tolerant to programs like cURL than send some terse http requests.
(Thanks to Albaro A. for this tip!)