spring-cloud/spring-cloud-gateway

Change HTTP method of request in-flight

Open

#539 geöffnet am 11. Sept. 2018

Auf GitHub ansehen
 (9 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Java (3.204 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (4.284 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 21h) (18 gemergte PRs in 30 T)

Beschreibung

I have a use-case for redirecting POST requests to /login to a static resource (the inescapable HTML Form of Doom) served by the gateway itself.

In the gateway, the best way I found to serve static resources is using the spring.webflux.static-path-pattern and spring.resources.static-locations properties, which delegate to the underpinning WebFlux framework. However, this will be able to serve only GET requests (besides HEAD and OPTIONS, which as expected return no content), while all other methods return 405.

Now, I would not say that accepting only GET is a wrong behavior for the serving of static resources. I would, however, appreciate the possibility of "normalizing" the request in the gateway before it lands on the underpinning WebFlux infrastructure, pretty much the same way we can modify a URI with org.springframework.cloud.gateway.route.builder.GatewayFilterSpec#changeRequestUri before it is forwarded to the other systems.

Any ideas?

Contributor Guide