question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

X-Forwarded-Port NumberFormatException: For input string: "443,443"

See original GitHub issue
    java.lang.NumberFormatException: For input string: "443,443"
    	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    	at java.lang.Integer.parseInt(Integer.java:580)
    	at java.lang.Integer.parseInt(Integer.java:615)
    	at springfox.documentation.swagger2.web.HostNameProvider.componentsFrom(HostNameProvider.java:72)

Is “443,443” a value that is supposed to be in “X-Forwarded-Port” in the first place?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
demaniakcommented, Mar 9, 2017

A little bit extra info - I just struck this problem when doing something slightly weird: basically I’m running Spring Boot zuul locally. I have a route setup that forwards to a another Zuul instance, behind which is the swagger ui and json I’m trying to access.

I thought at first that it was because I’m doing something extra-ordinarily silly, but it seems I am not alone 😃

Does any body have any references for “valid-ish” x-forwarded-port formats?

Stack trace for completeness:

[Request processing failed; nested exception is java.lang.NumberFormatException: For input string: "8088,80"] with root cause
java.lang.NumberFormatException: For input string: "8088,80"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at springfox.documentation.swagger2.web.HostNameProvider.componentsFrom(HostNameProvider.java:72)
	at springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(Swagger2Controller.java:84)
1reaction
emas80commented, Mar 8, 2017

Hi, we are having the same exact issue reaching swagger-ui from our Api Gateway, except that is “80,80” for us.

This started to happen after we upgraded Spring Cloud and Spring Boot on our Api Gateway that uses Zuul.

We see that the headers forwarded by the gateway are

“x-forwarded-proto”:“https,http” “x-forwarded-port”:“80,80” “x-forwarded-for”:“XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX”

If it can help, our current setup where Swagger does not work involves an Api Gateway using Spring Boot 1.4.4 and Spring Cloud CAMDEN.SR5, and the application(s) where Swagger is configured (and that is giving error) is behind the Api Gateway, and it uses Springfox Swagger 2.5.0 (the problem happens also with 2.6.1). Both the Api Gateway and the swagger-enabled application runs on Kubernetes, and the swagger ui is reached by calling Ingress, that redirects to the Api Gateway, that redirects to the application in the end.

The problem started when we upgraded our Api Gateway Spring Boot version from 1.3.8.RELEASE, and spring-cloud-netflix from 1.1.7.RELEASE, everything was ok on Kubernetes before. We think the new version of Spring Cloud adds (correctly?) the forward port, while before it did not add it.

Please note that on another setup not involving Kubernetes the issue is not present. If we have an ELB in front of the Api Gateway and then again the swagger-enabled application (both Api Gateway and the application running on normal EC2 instances - no kubernetes no docker just a good old Tomcat), then everything still works, with the old and with the new Spring Boot/Spring Cloud versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NumberFormatException: For input string: "443,80"
It's because X-Forwarded-Port contains every port number it was ever forwarded from, so if I understand your architecture correctly, it passes ...
Read more >
SOLVED: Jenkins Behind Caddy 2 Does Not Work - Help
I'm pretty certain some of these are the issue based on the java error mentioning ForwardedRequestCustomizer . In Caddy v2, the X-Forwarded-For ...
Read more >
reactor.netty.http.server.HttpServerRequest.hostAddress java ...
... URISyntaxException { String scheme = getScheme(request); String header = request. ... "192.168.0.1"); clientRequestHeaders.add("X-Forwarded-Port", ...
Read more >
2018-October.txt - Jboss List Archives
NumberFormatException: For input string : "tcp:" at java.lang. ... proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port 443; ...
Read more >
PK00848: JAVA.LANG.NUMBERFORMATEXCEPTION ... - IBM
PK00848: JAVA.LANG.NUMBERFORMATEXCEPTION: FOR INPUT STRING: "*" FOR PORT DEFINITION IN VIRTUALHOSTS.XML · Fixes are available · APAR status · Error description.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found