A few melted spots in headlight harness

If it got that warm, the whole harness has damage. I'd replace all the headlight wiring on the engine side, and maybe individual wires to the dimmer switch. Or convert to relays, as others mentioned.