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

Multiple values in X-Forwarded-Port throw NumberFormatException #368

Open
DhanarajuV opened this issue Jan 8, 2025 · 0 comments
Open

Multiple values in X-Forwarded-Port throw NumberFormatException #368

DhanarajuV opened this issue Jan 8, 2025 · 0 comments

Comments

@DhanarajuV
Copy link

In HttpServletRequests, below method is reading header and parsing it with Int.

public static int getPort(final HttpServletRequest req) {
	final String forwardedPort = req.getHeader("x-forwarded-port");
	return
		forwardedPort == null
			? req.getServerPort()
			: Integer.parseInt(forwardedPort)
	;
}

Issue: Many implementations will have x-forwarded-port with multiple port numbers with comma separated. like "443,443", they will get NumberFormatException while parsing. Please fix the issue as it is a blocker to use the redirect call in these scenarios.

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

1 participant