In the onRize() event, all you need to do is check if the width or height of the window is greater than your maximum width or height. Only in this case yout can set the maximum width or height.
if win.width > 500 then
win.width = 500
end
if win.height > 500 then
win.height = 500
end
In this case the user can change the window width and height. If it is higher then 500 the window width and height will be changed to 500. If it is under 500 the window width and heigth will stay where the user changed the border.