I'm currently using CloudFront to deliver a webpage that is hosted on an S3 Bucket.
On a subpath /cms I want to route all traffic to a PHP-based content management system that is running on EC2 and Apache and also has an API that is serving the data for my frontend.
I have huge trouble getting the traffic properly routed to the CMS. I added the EC2 instance as an origin and added this behavior to it.

This also reaches my Apache server. Problem is that all further paths lead to a 404 from Cloudfront. When I change the path pattern to /cms/* paths like /cms/api seem to work, but /cms alone will lead to a 404.
What's the correct way to just have anything with the beginning with the path /cms being routed to by backend?