spring-cloud / spring-cloud/spring-cloud-gateway

GatewayRouterFunctions.uri is no more

Open
#3,792 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Describe the bug
i need a forward proxy and thought i'd setup spring-cloud-gateway to fix that for me;

https://github.com/spring-cloud/spring-cloud-gateway/blob/v4.2.2/docs/modules/ROOT/pages/spring-cloud-gateway-server-mvc/java-routes-api.adoc#gateway-mvc-implementation-of-routerfunctionsbuilder

The docs here yield non-compiling code

versions

  • spring-cloud.version 2024.0.1
  • spring-cloud-gateway-server-mvc 4.2.1
	@Bean
	public RouterFunction<ServerResponse> getRoute() {
		return route("simple_route").GET("/info.0.json", http())
				.before(uri("https://xkcd.com"))
				.build();
	}

the uri method is not in GatewayRouterFunctions so docs are a bit off and i'm happy to fix that but i the code isn't clear on where it went :)

this yaml in config works and does what i want

spring:
  cloud:
    gateway:
      mvc:
        routes:
          - id: xkdc_route
            uri: https://xkcd.com
            predicates:
              - Path=/info.0.json

or see full demo project: proxy-foward.zip

tnx; happy to contribute any docs update(s) or other changes :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/modules/ROOT/pages/spring-cloud-gateway-server-mvc/java-routes-api.adoc and the GatewayRouterFunctions reference used by its example. Compare the documented Java route with the working YAML configuration and the supplied demo project to identify the current API. Done means the documentation uses a compiling example for the stated Spring Cloud Gateway versions and explains the applicable replacement or configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.