I created a undertow-handlers.conf in my WEB-INF folder.
I added a bunch of rows like this:
regex('/foo') -> redirect('/bar');
That works as expected, redirecting all requests of /foo to /bar.
Unfortunately, the response code is 302 (moved temporarily).
I need it to respond with 301 (moved permanently).
I can't manage how to do that. Any ideas?
I found the solution by myself:
regex('/foo') -> { set(attribute='%{o,Location}', value='/bar'); response-code(301); }