WinRM connection err: http response error: 401 - invalid content type

Hi,

I am trying to run packer on a modified windows AMI.
After the instance is created WinRm fails to connect with the following error:

2022/02/20 19:55:42 packer-plugin-amazon_v1.0.8_x5.0_windows_amd64.exe plugin: 2022/02/20 19:55:42 [INFO] Attempting WinRM connection…
2022/02/20 19:55:42 packer-plugin-amazon_v1.0.8_x5.0_windows_amd64.exe plugin: 2022/02/20 19:55:42 [DEBUG] connecting to remote shell using WinRM
2022/02/20 19:55:42 packer-plugin-amazon_v1.0.8_x5.0_windows_amd64.exe plugin: 2022/02/20 19:55:42 [ERROR] connection error: http response error: 401 - invalid content type
2022/02/20 19:55:42 packer-plugin-amazon_v1.0.8_x5.0_windows_amd64.exe plugin: 2022/02/20 19:55:42 [ERROR] WinRM connection err: http response error: 401 - invalid content type

When running Test-WsMan to this AWS instance i get a reply.
I tries running winrm enumerate winrm/config/listener on the instance and i see that it listent on http port 5985.

I am using bootstrap file used in the example on your site.
Alst tried running the bootstrap with SSL and i see the instance is listening on 5986 and HTTPS but still doesnt work.
Tried removing the password from the file, tried https, nothing works.
Thanks,