After upgrading to Nuxt 3.7 URLs, generated from a backend proxied via the dev server, which is accessible via https, contain the wrong protocol ("http" instead of "https").
After some digging, it turned out that httpxy has a middleware which determines if the request came via https (hasEncryptedConnection(req) which evaluates req.connection.encrypted) and sets the x-forwarded-proto accordingly to either "http" or "https".
So far I wasn't able to find out why, but although the dev server is listening to https, the req, passed to the proxy middleware, doesn't seem to have a TLSSocket connection, hence isn't recognised to be encrypted, hence sets the wrong x-forwarded-proto header.
It worked just fine in Nuxt 3.6.
// nuxt.config.tsexportdefaultdefineNuxtConfig({nitro: {devProxy: {'/api/': {target: 'https://localhost:8000/api/',autoRewrite: true,changeOrigin: true,xfwd: true,}},devServer: {https: {key: './key.pem',cert: './cert.pem',},},});
After upgrading to Nuxt 3.7 URLs, generated from a backend proxied via the dev server, which is accessible via https, contain the wrong protocol ("http" instead of "https").
After some digging, it turned out that httpxy has a middleware which determines if the request came via https (
hasEncryptedConnection(req)which evaluatesreq.connection.encrypted) and sets thex-forwarded-protoaccordingly to either "http" or "https".So far I wasn't able to find out why, but although the dev server is listening to https, the
req, passed to the proxy middleware, doesn't seem to have a TLSSocket connection, hence isn't recognised to be encrypted, hence sets the wrongx-forwarded-protoheader.It worked just fine in Nuxt 3.6.