Limiting maximum voltage
Best way is to use a transformer after your 40V AC to get voltage down to about 15V. Then place a rectifier.

Or use a buck with higher input voltage.

Btw. the rectified voltage is equal (little less) to max value of AC voltage, not rms.

Edit:

To make it clear I added a waveform of rectifier with 4OV input amplitude (blue) which is a 28Vrms and rectified output (green).