Skip to content

issue of accept HTTP connection behind a SSL enabled proxy #83

@clockrun

Description

@clockrun

Describe the bug
I'm running application on Kubernetes. Where SSL connection is handled on ingress (nginx) side, and java application is using HTTP. Now there are to situation:

  1. by using default setup, because I'm not using SSL on java side, it tries to redirect me to http
2023-01-03 02:56:03.084 DEBUG 1 --- [nio-8080-exec-1] o.s.security.web.FilterChainProxy : Securing GET /somePath
--
Tue, Jan 3 2023 10:56:03 am | 2023-01-03 02:56:03.091 DEBUG 1 --- [nio-8080-exec-1] o.s.s.w.a.c.ChannelProcessingFilter : Request: filter invocation [GET /somePath]; ConfigAttributes: [REQUIRES_INSECURE_CHANNEL]
Tue, Jan 3 2023 10:56:03 am | 2023-01-03 02:56:03.091 DEBUG 1 --- [nio-8080-exec-1] o.s.s.w.a.c.RetryWithHttpEntryPoint : Redirecting to: http://example.com/somePath

becuase I set to redirect all http traffic to https on ingress, then this become endless redirect and causing error Error: Exceeded maxRedirects. Probably stuck in a redirect loop in the end
2. if i defined server.ssl.enabled=true, then I must generate and define certificate / keystore in java, which is not neccessary in my case

Code sample
Problematic code are as below

		if (isSsl) {
			http.requiresChannel().anyRequest().requiresSecure();
		} else {
			http.requiresChannel().anyRequest().requiresInsecure();
		}

Expected behavior
when using behind a SSL proxy and not using SSL on java side, do not reject connection or redirect

Additional context

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions