Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Togglz Console 404 not found error with WebFlux #920

Open
MunishCool opened this issue Jan 30, 2023 · 5 comments
Open

Togglz Console 404 not found error with WebFlux #920

MunishCool opened this issue Jan 30, 2023 · 5 comments

Comments

@MunishCool
Copy link

Hi,

Currently, I am working on a web flux application, and my togglz implementation is working fine with all the features implemented using SpringSecurityUserProvider and JDBCStateRepository, but the toggle console is not working, and I am getting a 404 Not Found exception. Please guide me if I am missing something. Below is the configuration.

        <togglz.version>3.3.3</togglz.version>
	<spring.boot.version>2.7.4</spring.boot.version>
	
	<!-- Togglz dependencies-->
		<dependency>
			<groupId>org.togglz</groupId>
			<artifactId>togglz-spring-boot-starter</artifactId>
			<version>${togglz.version}</version>
		</dependency>
		<dependency>
			<groupId>org.togglz</groupId>
			<artifactId>togglz-console</artifactId>
			<version>${togglz.version}</version>
		</dependency>
		<dependency>
			<groupId>org.togglz</groupId>
			<artifactId>togglz-spring-security</artifactId>
			<version>${togglz.version}</version>
		</dependency>
		<dependency>
			<groupId>org.togglz</groupId>
			<artifactId>togglz-spring-web</artifactId>
			<version>${togglz.version}</version>
		</dependency>

To ensure the console is working, I have disabled the security in my SpringSecurityConfig file.

@Bean
    SecurityWebFilterChain buildActuatorFilterChain(ServerHttpSecurity http) {
        http.authorizeExchange(exchanges -> exchanges.pathMatchers("/actuator/**").permitAll()
                .pathMatchers("/togglz-console/**").permitAll().anyExchange().authenticated());
        return http.build();
    }

Properties:

I have tried both with .properties and .yaml

togglz.console.enabled=true
togglz.console.path=/togglz-console
togglz.console.secured=false
togglz.console.use-management-port=false
togglz:
  console:
    enabled: true # Enable admin console.
    secured: false
    path: /togglz-console # The path of the admin console when enabled.
    use-management-port: false

Error:

2023-01-30 14:25:21.671 [reactor-http-nio-3] DEBUG o.s.w.s.a.HttpWebHandlerAdapter - [1b3e48ae-1] HTTP GET "/togglz-console/"
2023-01-30 14:25:21.695 [parallel-2] DEBUG o.s.w.s.s.DefaultWebSessionManager - Created new WebSession.
2023-01-30 14:25:21.706 [parallel-2] DEBUG o.s.w.r.h.SimpleUrlHandlerMapping - [1b3e48ae-1] Mapped to ResourceWebHandler [classpath [META-INF/resources/], classpath [resources/], classpath [static/], classpath [public/]]
2023-01-30 14:25:21.707 [parallel-2] DEBUG o.s.w.r.resource.ResourceWebHandler - [1b3e48ae-1] Resource not found
2023-01-30 14:25:21.725 [parallel-2] DEBUG o.s.w.s.h.ResponseStatusExceptionHandler - [1b3e48ae-1] Resolved [ResponseStatusException: "404 NOT_FOUND"] for HTTP GET /togglz-console/
2023-01-30 14:25:21.730 [parallel-2] DEBUG o.s.w.s.a.HttpWebHandlerAdapter - [1b3e48ae-1] Completed 404 NOT_FOUND

image

@bennetelli
Copy link
Member

Hey,

the problem is, WebFlux is based on an reactive approach whereas the togglz-console is based on servlets which is heavily on a request/response/non-reactive technology.

I will need to change the console from using servlets to something else, but this is a heavy task.
In the meantime you could use the Spring Actuator endpoints to switch and query your togglz feature and their states. I know some togglz users doing this already.
Sorry.. I don't have a working solition for the togglz-console in combination with webflux/reactive stuff for now besides using the actuator endponts :/

best regards
Bennet

@MunishCool
Copy link
Author

Hi @bennetelli

Thanks for the reply. Yes, I have found one open ticket where web flux is not supporting the toggle console. I have implemented the actuator endpoint to change the state of the features. Thanks, at least we have some way of playing around.

Regards,
Munish

@bennetelli
Copy link
Member

Welcome :) Glad you can work with togglz even when it's not as comfortable with WebFlux as with non-reactive frameworks.

It's still on my list and I will work on this as soon as I will have some time between projects.

@bennetelli
Copy link
Member

#945

@hantsy
Copy link

hantsy commented Apr 12, 2023

From the source codes, it seems console is based on the traditional spring webmvc, does not support webflux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants