'Apache hostname and wildfly not working with ajp

I developed an api server with Apache Camel and deployed on wildfly 20.

The apis are working without problem if I use the server ip address, but now I'd like to use a domain.

All my endpoints have the prefix /AGServices so here is the apache vhost:

<VirtualHost *:80>
        ServerAdmin <serveradmin>
        ServerName <domain>
        ServerAlias <domainalias>

        DocumentRoot /srv/www/vhosts/_AG

        ErrorLog "|/usr/sbin/rotatelogs2 /var/log/apache2/_AG-error_log-%Y%m%d_%H%M%S 512M"
        TransferLog "|/usr/sbin/rotatelogs2 /var/log/apache2/_AG-access_log-%Y%m%d_%H%M%S 512M"
        CustomLog "|/usr/sbin/rotatelogs2 /var/log/apache2/_AG-request_log-%Y%m%d_%H%M%S 512M" 

        LogLevel debug

        <Directory "/srv/www/vhosts/_AG">
                AllowOverride None
                Require all granted
        </Directory>

        JkMount /jkstatus status
        JkMount /jmx-console ag
        JkMount /jmx-console/* ag

        JkMount /AGServices ag
        JkMount /AGServices/* ag

</VirtualHost>

The worker properites:

worker.list=ag

worker.ag.port=9309
worker.ag.host=<server host>
worker.ag.type=ajp13

The ajp port is correct, the application is working correctly on wildfly, but when I try to call the endpoint with the domain it responds "not found". The error is from jk_mod log, as the request never reach wildfly.

[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1185): Attempting to map URI '/AGServices/......' from 9 maps
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] find_match::jk_uri_worker_map.c (980): Attempting to map context URI '/jmx-console/*=ag' source 'JkMount'
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] find_match::jk_uri_worker_map.c (980): Attempting to map context URI '/AGServices/*=ag' source 'JkMount'
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] find_match::jk_uri_worker_map.c (993): Found a wildchar match '/AGServices/*=ag'
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] jk_handler::mod_jk.c (2823): Into handler jakarta-servlet worker=ag r->proxyreq=0
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] wc_get_worker_for_name::jk_worker.c (120): found a worker ag
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] wc_maintain::jk_worker.c (353): Maintaining worker ag
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] wc_get_name_for_type::jk_worker.c (304): Found worker type 'ajp13'
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] init_ws_service::mod_jk.c (1196): Service protocol=HTTP/1.1 method=GET ssl=false host=(null) addr=IP_ADDRESS name=SERVER_NAME port=80 auth=(null) user=(null) laddr=IP_ADDRESS raddr=AP_ADDRESS uaddr=IP_ADDRESS uri=/AGServices/.....
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_get_endpoint::jk_ajp_common.c (3356): (ag) acquired connection pool slot=0 after 0 retries
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (684): (ag) ajp marshaling done
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_service::jk_ajp_common.c (2591): processing ag with 2 retries
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_send_request::jk_ajp_common.c (1722): (ag) no usable connection found, will create a new one.
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] jk_open_socket::jk_connect.c (675): socket TCP_NODELAY set to On
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] jk_open_socket::jk_connect.c (799): trying to connect socket 64 to 10.151.5.25:9309
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] jk_open_socket::jk_connect.c (825): socket 64 [10.151.5.25:59354 -> 10.151.5.25:9309] connected
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): sending to ajp13 pos=4 len=1619 max=8192
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): 0000    12 34 06 4F 02 02 00 08 48 54 54 50 2F 31 2E 31  - .4.O....HTTP/1.1
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): 0010    00 00 29 2F 41 47 53 65 72 76 69 63 65 73 2F 6D  - ..)/AGServices/.
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): 0020    65 74 65 72 73 2F 30 37 4D 31 45 35 41 32 31 31  - eters/..........
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): 0030    33 30 39 39 36 34 34 2F 6B 65 79 73 00 00 0C 31  - ...............1
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_send_request::jk_ajp_common.c (1782): (ag) request body to send 0 - request body to resend 0
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): received from ajp13 pos=0 len=136 max=8192
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0000    04 01 94 00 09 4E 6F 74 20 46 6F 75 6E 64 00 00  - .....Not.Found..
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0010    05 00 0C 58 2D 50 6F 77 65 72 65 64 2D 42 79 00  - ...X-Powered-By.
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0020    00 0A 55 6E 64 65 72 74 6F 77 2F 31 00 00 06 53  - ..Undertow/1...S
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0030    65 72 76 65 72 00 00 0A 57 69 6C 64 46 6C 79 2F  - erver...WildFly/
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0040    31 30 00 A0 01 00 17 74 65 78 74 2F 68 74 6D 6C  - 10.....text/html
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0050    3B 63 68 61 72 73 65 74 3D 55 54 46 2D 38 00 A0  - ;charset=UTF-8..
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0060    03 00 02 36 38 00 A0 04 00 1D 54 75 65 2C 20 32  - ...68.....Tue,.2
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0070    35 20 4A 61 6E 20 32 30 32 32 20 30 38 3A 30 36  - 5.Jan.2022.08:06
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0080    3A 34 38 20 47 4D 54 00 00 00 00 00 00 00 00 00  - :48.GMT.........
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (ag) status = 404
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (746): Number of headers is = 5
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (802): (ag) Header[0] [X-Powered-By] = [Undertow/1]
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (802): (ag) Header[1] [Server] = [WildFly/10]
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (802): (ag) Header[2] [Content-Type] = [text/html;charset=UTF-8]
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (802): (ag) Header[3] [Content-Length] = [68]
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_unmarshal_response::jk_ajp_common.c (802): (ag) Header[4] [Date] = [Tue, 25 Jan 2022 08:06:48 GMT]
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): received from ajp13 pos=0 len=72 max=8192
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0000    03 00 44 3C 68 74 6D 6C 3E 3C 68 65 61 64 3E 3C  - ..D<html><head><
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0010    74 69 74 6C 65 3E 45 72 72 6F 72 3C 2F 74 69 74  - title>Error</tit
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0020    6C 65 3E 3C 2F 68 65 61 64 3E 3C 62 6F 64 79 3E  - le></head><body>
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0030    4E 6F 74 20 46 6F 75 6E 64 3C 2F 62 6F 64 79 3E  - Not.Found</body>
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0040    3C 2F 68 74 6D 6C 3E 00 00 00 00 00 00 00 00 00  - </html>.........
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ws_write::mod_jk.c (552): written 68 out of 68
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): received from ajp13 pos=0 len=2 max=8192
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_connection_tcp_get_message::jk_ajp_common.c (1462): 0000    05 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00  - ................
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_process_callback::jk_ajp_common.c (2135): (ag) AJP13 protocol: Reuse is OK
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_reset_endpoint::jk_ajp_common.c (851): (ag) resetting endpoint with socket 64
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] ajp_done::jk_ajp_common.c (3287): recycling connection pool for worker ag and socket 64
[Tue Jan 25 09:06:48 2022] [13852:139737947764928] [debug] jk_handler::mod_jk.c (2979): Service finished with status=404 for worker=ag

The apache camel has been configured with an undertow server working on port 9180



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source