1
resposta

Redirecionamento com bind de porta

Eu criei uma imagem com base no ubuntu com Websphere 7 e criei um profile padrão. O problema acontece que a aplicação faz uma navegação para uma outra página adicionando a chave Location no header do response , e esse redirecionamento usa a porta que ele conhece (no caso a 9080), mas o meu binding está, por exemplo para a 9081. Existe alguma maneira de fazer com que o container trate isso, ou vou ter que criar uma imagem para cada porta?

Abaixo o meu dockerfile e o comando run Dockerfile:

EXPOSE 9080 9060 9043 9443 2809

COPY ./Linux_x86_64/* /usr/installation/
COPY ./Linux_x86_64/options/*.txt ./scripts /usr/
COPY ./scriptLibraries /usr/scriptLibraries/
COPY ./libs /usr/libs/

RUN rm -rf /var/lib/apt/lists/* \
    && cd /bin \
    && rm sh \
    && ln -s bash sh \
    && mkdir /usr/installation/WAS7 \
    && mkdir /usr/installation/ui \
    && chmod +x /usr/start_server \
    && tar xzf /usr/installation/was.7000.wasdev.nocharge.linux.amd64.tar.gz -C /usr/installation/WAS7 \
    && /usr/installation/WAS7/WAS/install -options /usr/responsefile.txt -silent -is:javaconsole \
    && /opt/IBM/WebSphere/AppServer/bin/manageprofiles.sh -create -profileName AppSrv01 -profilePath /opt/IBM/WebSphere/AppServer/profiles/AppSrv01 -templatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default -nodeName DefaultNode01 -cellName DefaultCell01 -hostName localhost -serverName server1 -enableAdminSecurity false;exit 0

RUN tar xzf /usr/installation/7.0.0.43-WS-UPDI-LinuxAMD64.tar.gz -C /usr/installation/ui \
    && /usr/installation/ui/UpdateInstaller/install -options /usr/responsefile.update_installer.txt -silent -is:javaconsole \
    && cp /usr/installation/*.pak /opt/IBM/WebSphere/UpdateInstaller/maintenance \
    && /opt/IBM/WebSphere/UpdateInstaller/update.sh -silent -options "/usr/responsefile.update.txt" \
    && mv /opt/IBM/WebSphere/AppServer/scriptLibraries /opt/IBM/WebSphere/AppServer/scriptLibraries_old \
    && mv /usr/scriptLibraries /opt/IBM/WebSphere/AppServer/scriptLibraries \
    && /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startServer.sh server1 \
    && /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -lang jython -f /usr/convertWMQRA.py \
    && /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -lang jython -f /usr/server_setup.py \
    && rm -rf /usr/installation \
    && rm -rf /opt/IBM/WebSphere/AppServer/scriptLibraries_old \
    && rm /usr/*.sh /usr/*.py /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/*.log

CMD ["/usr/start_server"]

Linha de comando RUN utilizada

docker run -it --name was7 -p 9081:9080 -p 9061:9060 -p 2810:2809 intera/was7_64:7.0.0.43

Quando eu faço um wget aparece o seguinte:

root@docker:~# --2018-05-04 11:09:51--  http://localhost:9081/myapp/inicio.xhtml
Resolvendo localhost (localhost)... ::1, 127.0.0.1
Conectando-se a localhost (localhost)|::1|:9081... conectado.
A requisição HTTP foi enviada, aguardando resposta... 302 Found
Localização: http://localhost:9080/myapp/error.xhtml [redirecionando]
--2018-05-04 11:09:51--  http://localhost:9080/myapp/error.xhtml
Conectando-se a localhost (localhost)|::1|:9080... conectado.
A requisição HTTP foi enviada, aguardando resposta... 302 Found
Localização: http://localhost:9080/myapp/spring_security_login [redirecionando]
--2018-05-04 11:09:51--  http://localhost:9080/myapp/spring_security_login
Reaproveitando a conexão existente para [localhost]:9080.
1 resposta

Olá Jonas, tudo bem?

Quem faz esse redirecionamento, e adiciona o header location ?

[]s

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software