Skip to content

Wrong redirection in containerized environment #38

@bfedoronchuk

Description

@bfedoronchuk

Environment Details

  • OS: MacOS
  • Docker version: 20.10.5 Community
  • JDK version: 11
  • MicroProfile implementation: Helidon MP
  • Helidon Version: 2.3.2

Problem Description

Path /openapi-ui redirects to the wrong URI if the MicroProfile app is running inside of Docker container. Extension swaps the host and port to values defined by the container.

I haven't dived deep into the bug, but at least I realized that injected javax.ws.rs.core.UriInfo provides the wrong base URI. As far as I know, Helidon uses Jersey as JAX-RS implementation. So, this problem could be Jersey-specific.

Steps to reproduce

Steps to reproduce:

  1. Setup Helidon MP (Microprofile implementation) example project.
mvn -U archetype:generate -DinteractiveMode=false \
    -DarchetypeGroupId=io.helidon.archetypes \
    -DarchetypeArtifactId=helidon-quickstart-mp \
    -DarchetypeVersion=2.3.2 \
    -DgroupId=io.helidon.examples \
    -DartifactId=openapi-ui-issue \
    -Dpackage=io.helidon.examples.quickstart.mp;
  1. Go to pom.xml and add the dependency.
<dependency>
    <groupId>org.microprofile-ext.openapi-ext</groupId>
    <artifactId>openapi-ui</artifactId>
    <version>1.1.4</version>
</dependency>
  1. Go to the project.
cd openapi-ui-issue;
  1. Build Docker image.
docker build -t openapi-ui-issue . 
  1. Run Docker container.
docker run --rm -p 9090:8080 openapi-ui-issue:latest
  1. Open http://127.0.0.1:9090/openapi-ui in the browser.
    Browser redirects to the wrong path: http://172.17.0.2:8080/openapi-ui/index.html
    Where 172.17.0.2 is the Docker container internal IP and 8080 is the port of the app running inside of the container.

By the way, everything works fine if you specify the full path: http://127.0.0.1:9090/openapi-ui/index.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions