I use undertow to serve some app logs, but I can't figure out how to sort files, for example for modification time... is there a way?
This is the subsystem conf:
<subsystem xmlns="urn:jboss:domain:undertow:3.0">
...
<server name="default-server">
...
<host name="default-host" alias="localhost">
...
<location name="/logs" handler="logs"/>
...
</host>
...
</server>
...
<handlers>
...
<file name="logs" path="/home/app/logs" directory-listing="true"/>
</handlers>
...
</subsystem>
Related
we are using wildfly-9.01 on azure environment and using application gateway and WAF services.
We observe 502 in apache log in underload and application became unresponsive.
We are using following configuration.
OS: centos-8(32 vcpus, 256 GiB memory)
web server: apache with modjk
application server: wildfly-9.01(40 GB memory is allocated)
Below is the Wildfly configuration:
<subsystem xmlns="urn:jboss:domain:io:1.1">
<worker name="default" task-max-threads="500"/>
<buffer-pool name="default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajpListener" scheme="http" socket-binding="ajp" max-header-size="50000" max-post-size="5368709120" max-parameters="5000000" allow-equals-in-cookie-value="true"/>
<http-listener name="default" socket-binding="http" redirect-socket="https" max-header-size="50000" max-post-size="5368709120" max-parameters="5000000" allow-equals-in-cookie-value="true"/>
<host name="default-host" alias="localhost"/>
</server>
<servlet-container name="default">
<jsp-config x-powered-by="false"/>
<websockets/>
</servlet-container>
<filters>
<response-header name="server-header" header-name="Server" header-value="My company"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="My company Application"/>
</filters>
</subsystem>
Below is the Apache Keep alive config:
KeepAlive On
MaxKeepAliveRequests 300
KeepAliveTimeout 600
TimeOut 1200
any suggestions for things to look at or try to avoid 502?
We're using Wildfly-17.0.1
and we have 2 spring-boot microservices which are being deployed as war on wildfly
service-a.war
service-b.war
We have jboss-web.xml in both services under src/main/webapp/WEB-INF
service-a.war
<jboss-web>
<context-root>/</context-root>
<virtual-host>default-host</virtual-host>
</jboss-web>
service-b.war
<jboss-web>
<context-root>/</context-root>
<virtual-host>b-host</virtual-host>
</jboss-web>
standalone.xml
<subsystem xmlns="urn:jboss:domain:undertow:9.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default" />
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" />
<https-listener name="https" socket-binding="https" security-realm="UndertowRealm" enable-http2="true" />
<host name="default-host" alias="alias" default-web-module="service-a.war" />
<host name="b-host" alias="alias" default-web-module="service-b.war" />
</server>
...
</subsystem>
Above alias is the machine name
In the server.log we see below message when both applications are deployed
...
Registered web context: '/' for server 'default-server'
...
Registered web context: '/' for server 'default-server'
But when we try to access both services only one of the service seems to be working, other gives
<html><head><title>Error</title></head><body>404 - Not Found</body></html>
We tried giving different context-root, and we saw this in log
...
Registered web context: '/a' for server 'default-server'
...
Registered web context: '/b' for server 'default-server'
but still only one works and other gives 404.
It works when we give different alias for both the hosts
Why giving the same alias for different hosts doesn't work?
I think the string you put as virtualhost in jboss-web.xml must match the alias (not the name) in standalone conf
Instead of
<host name="b-host" alias="alias" default-web-module="service-b.war" />
Try with:
<host name="vhost2" alias="b-host" default-web-module="service-b.war" />
I'm trying to redirect my URL with the following settings in the standalone.xml:
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/en/" handler="en"/>
<location name="/de/" handler="de"/>
<location name="/" handler="de"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="en" path="${jboss.home.dir}/standalone/deployments/en"/>
<file name="de" path="${jboss.home.dir}/standalone/deployments/de"/>
</handlers>
My handlers point on to the matching angular frontend-projects in the deployments folder of my wildfly-server, where also my EAR-file is deployed.
This works fine except for one case: If i refresh my detail-page, which looks like this: localhost:8080/en/details/1234 i get an error
404 - Page not found
I already tried <location name="/en/details/1234" handler="en"/> which works, but obviously only for that specific id.
In my understanding this could be solved by adding something like
<location name="/en/details/(.*)" handler="en"/>
My problem is that I can't figure out how to put a placeholder like a regular expression after "details/". Is that even possible? Or is there a better way of handling this redirection/rewriting problem?
I already gave undertow-handlers.conf a shot, but it felt like it never really triggered the rewrite rules I implemented there.
I'm currently trying to use an URL rewrite for content I delivered via a file handler from local file system. There doesn't seems to be a documentation and/or functionality for this. I guess I would work fine using a war file (as answered in this forum https://developer.jboss.org/message/915980) but unluckily this does not work for my stuff.
My configuration looks like this
<server name="default-server">
<http-listener name="default" socket-binding="http" max-post-size="51200000" max-parameters="10000"/>
<https-listener name="https" socket-binding="https" max-post-size="51200000" max-parameters="10000" security-realm="UndertowRealm"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<access-log rotate="true"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<filter-ref name="connection"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
</servlet-container>
<handlers>
<file name="welcome-content" path="C:/path/to/private/docroot"/>
</handlers>
I tried to rebuild my docroot, that it looks like an exposed .war file, so I could add a WEB-INF/undertow-handler.conf file, containing the simply following rule:
regex['/Deploy/stuff/laptop/windows/(.*)/update.xml'] -> rewrite['/Deploy/stuff/laptop/windows/new-update.xml']
but this file and/or rule seems to be plainly ignored.
Any help is greatly appreciated.
It should be undertow-handlers.conf, with an s.
I'm trying to redirect http connections to https in JBoss AS 7.1.1 using the rewrite valve inside a virtual host. This is my current configuration in standalone.xml:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl name="my-ssl" key-alias="my-alias" password="pass" certificate-key-file="/path/to/keystore"/>
</connector>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
<rewrite pattern=".*" substitution="https://myserver.com:8443" flags="R,L">
<condition test="%{HTTPS}" pattern="off" flags="NC"/>
</rewrite>
</virtual-server>
</subsystem>
The http port is 8080 and the https is 8443. Access to http://myserver.com:8080 are redirected correctly to https://myserver.com:8443, but (this is the issue I'm trying to resolve) access to http://myserver.com:8443 return an empty HTTP 200 OK response.
It is correct that JBoss apparently accepts http connections in the https port, or there is an error in the server configuration? If there isn't a error, how can I redirect http://myserver.com:8443 to https://myserver.com:8443?