In the below circuit, the diodes protect the LM317 against both of the caps discharging into the IC when input or output is shorted. LM317 is itself capable of having it's output shorted without damage. But the input-output voltage difference must not exceed 40V. In my circuit, I'm applying 45V to the input, and getting 30V from the output. In normal conditions this means a 15V difference over the IC and everything is fine, but if the output gets shorted somehow (maybe because of the initial charging of large capacitors connected to the output), I get a full 45V above the IC and this is enough to damage it according to datasheet (it's above the 40V maximum).
What can I do to prevent this, without using another IC like LM317HV?