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

Spring Boot WebFlux 3.0.3 results in the hostname "0:0:0:0:0:0:0:1" #2090

Closed
davidmelia opened this issue Feb 23, 2023 · 5 comments
Closed
Labels
invalid This doesn't seem right

Comments

@davidmelia
Copy link

Describe the bug

After upgrading from Spring Boot WebFlux 3.0.2 to Spring Boot WebFlux 3.0.3 I am getting an odd hostname:

image

To Reproduce
I have a super simple spring boot 3.0.3 project in https://github.com/davidmelia/open-api-issues-hostname

Navigating to http://localhost:8080/webjars/swagger-ui/index.html#/home-controller/home you can see the odd hostname

Expected behavior

if you downgrade to boot 3.0.2 in the pom you get the usual hostname:
image

@programista-zacny
Copy link

I have the same problem but I reproduce it a little bit different.

My properties:

springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/swagger-ui

When I open url http://127.0.0.1:8080/api-docs everything is working fine.
When I try http://localhost:8080/api-docs I have an error:

java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - Error at index 1 in: "0]"

Temurin JDK17, URLDecoder.java:235, param String s -> http://[0:0:0:0:0:0:0:1%0]:8080/api-docs
I'm using newest up-to-date Linux Manjaro.

@JohnNiang
Copy link
Contributor

This might be caused by spring-projects/spring-framework@5847454.

@aperusset
Copy link

aperusset commented Mar 1, 2023

Hi everyone !

I have exactly the same issue with Spring Boot 3.0.3, running on Ubuntu 20.04.5 LTS.

Additionnaly, it causes some issues with actuator/prometheus, as the URLs are shown in my browser with IPV6 localhost resolution :

{
  "_links": {
    "self": {
       "href": "http://[0:0:0:0:0:0:0:1%250]:9321/metrics",
       "templated": false
  },
  ...
}

I was able to quick fix this by adding these properties to my application.yml file :

server.address: 127.0.0.1
management.server.address: 127.0.0.1

Another solution is to add a command line argument to the JVM : -Djava.net.preferIPv4Stack=true

Does anyone openend an issue to Spring Framework repository or find a "real" fix ?

Edit : just found the related issue spring-projects/spring-framework#30033

@JohnNiang
Copy link
Contributor

Just upgrade Spring Boot 3.0.4 to solve this problem.

image

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Mar 8, 2023

It's a spring-boot issue.
spring-boot 3.0.4 resolves this issue!

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

5 participants