I have this configuration in place:

haproxy(80,443) --> httpd(8443) --> tomcat(8096)

Going to https://websrv1/test will result in a 301 redirect to the httpd port for which haproxy should be proxying requests. So the user is redirected to http://websrv1:8443/test.

But, if the user goes to https://websrv1/test/ - specifying a the trailing slash - it works just fine.

How can I prevent this redirection from happening, when the user DOES NOT specify a trailing slash?

  • haproxy configuration?
  • apache url rewrite?
  • tomcat url rewrite?

The problem is on the Apache level.

You could try to set

UseCanonicalName On


ServerName websrv1:80

in your Apache config to make apache use the correct rewrite.

Alternatively you could disable the rewrite of the trailing slash with

DirectorySlash Off

See UseCanonicalName, ServerName and DirectorySlash

  • Thanks. I tried all the options that you suggested and the problem persists. – BlackBeret Aug 6 '13 at 7:10
  • It is possible that your browser has the redirects cached because the are set with a permanent redirect – Christopher Perrin Aug 6 '13 at 10:40
  • Nope.. I tried after cleaning all caches. – BlackBeret Aug 6 '13 at 10:54
  • I don't know if HAProxy caches rewrites. But that might be possible. – Christopher Perrin Aug 6 '13 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.