# Ansible - Bad HTTP Response

**URL:** <https://forum.ansible.com/t/ansible-bad-http-response/7397>\
**Category:** Get Help\
**Tags:** windows, ansible-core\
**Created:** [July 22, 2024, 12:09pm UTC](https://forum.ansible.com/t/ansible-bad-http-response/7397 "2024-07-22T12:09:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@Ray](https://forum.ansible.com/u/Ray)\
**Post date:** [July 22, 2024, 12:09pm UTC](https://forum.ansible.com/t/ansible-bad-http-response/7397/1 "2024-07-22T12:09:49Z")

</div>

I installed Ansible on a VM and want to automate Windows Updates on Windows Hosts. When i try to ping the hosts with the command: `ansible test -m win_ping -vvv` i receive a Bad HTTP Error

```auto
client.xxx.DE | UNREACHABLE! => {
    "changed": false,
    "msg": "kerberos: Bad HTTP response returned from server. Code 502, plaintext: Bad HTTP response returned from server. Code 502",
    "unreachable": true
}

```

The ansible host file:

```auto
[test]
client.xxx.DE

[test:vars]
ansible_user=User@xxx.DE
#ansible_passwort=Passwort
ansible_connection=winrm
ansible_transport=kerberos
ansible_port=5985

```

Krb5.conf File:

```auto

[libdefaults]
        default_realm = xxx.DE
        allow_weak_crypto = true
        kdc_timesync = 1
        ccache_type = 4
        forwardable = true
        proxiable = true
        fcc-mit-ticketflags = true

[realms]
XXX.DE = {
        kdc = dc1.xxx.de
        kdc = dc2.xxx.de
 }

[domain_realm]
.xxx.de = XXX.DE
xxx.de = XXX.DE

```

When i test the connection via `nc -z -w1 client 5985;echo $?` i get a return of 0

The win WINRM Config on the remote host:

```auto
Service
    RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
    MaxConcurrentOperations = 4294967295
    MaxConcurrentOperationsPerUser = 1500
    EnumerationTimeoutms = 240000
    MaxConnections = 300
    MaxPacketRetrievalTimeSeconds = 120
    AllowUnencrypted = true
    Auth
        Basic = false
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    IPv4Filter = xxx-xxx [Source="GPO"]
    IPv6Filter [Source="GPO"]
    EnableCompatibilityHttpListener = false
    EnableCompatibilityHttpsListener = false
    CertificateThumbprint
    AllowRemoteAccess = true [Source="GPO"]

```

We use a proxy Server in our environment

---

<div class="post-metadata">

**Author:** ![Iwan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iwan/32/5429_2.png) [@Iwan](https://forum.ansible.com/u/Iwan)\
**Post date:** [November 13, 2024, 9:56am UTC](https://forum.ansible.com/t/ansible-bad-http-response/7397/2 "2024-11-13T09:56:07Z")

</div>

I had the same issue, and here is ho I fixed it:

 ![image](https://us1.discourse-cdn.com/ansible/original/2X/c/ce5b752dda6a80524444984bd2aedb5e6cc84ab9.png)

I hope it helps.
