When instancing object on a curve, the first and last objects go beyond the curve length, like in this picture:
If I adjust the position of the first and last point, it creates a new problem where the instances are not evenly distributed:
How can I fit the objects inside the limits of the curve while still preserve the even distribution of the instances?
EDIT:
The answer from @vajtus solved my problem.
I just added some nodes to his answer so this setup can be used in more situations. This way if you add any Geometry still should work.