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

Autoconfigure Reactor Netty for CloudFoundry endpoint #13445

Closed
nkolosnjaji opened this issue Jun 11, 2018 · 1 comment
Closed

Autoconfigure Reactor Netty for CloudFoundry endpoint #13445

nkolosnjaji opened this issue Jun 11, 2018 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@nkolosnjaji
Copy link
Contributor

nkolosnjaji commented Jun 11, 2018

CloudFoundry AppsManager actuator features aren't working with Reactor Netty by default. CloudFoundry endpoint is returning links without https so browser doesn't send request to /cloudfoundryapplication/* endpoints because they are not secure.

response from /cloudfoundryapplication

{
  "_links": {
    "httptrace": {
      "href": "http:\/\/actuator-app.cfapps.io\/cloudfoundryapplication\/httptrace",
      "templated": false
    },
...
...
  }
}

Spring Boot 2.1 is now using Reactor Netty 0.8 which has X-Forwarded-* HTTP header support.

Following configuration made Apps manager features work again with Reactor Netty

@Configuration 
class NettyConfiguration {

	@Bean
	WebServerFactoryCustomizer<NettyReactiveWebServerFactory> configure() {
		return factory -> factory.addServerCustomizers(new EventLoopNettyCustomizer());
	}

}

class EventLoopNettyCustomizer implements NettyServerCustomizer {

    @Override
    public HttpServer apply(HttpServer httpServer) {
    	return httpServer.forwarded();
    }
}

As server.use-forward-headers are autoconfigure to true for CloudFoundry and Heroku platforms, ReactiveWebServerFactoryCustomizer could use this autoconfigured value and setup servers to use forwarded headers.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 11, 2018
@mbhave
Copy link
Contributor

mbhave commented Jun 11, 2018

@nkolosnjaji thanks, but we already have an issue open for supporting X-Forwarded-* headers for WebFlux applications here.

@mbhave mbhave closed this as completed Jun 11, 2018
@mbhave mbhave added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants