Spring Security Https错误端口 [英] Spring Security Https Wrong Port

查看:324
本文介绍了Spring Security Https错误端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在自己的网站上使用https登录页面时,春季安全性转发正在使用错误的端口:

When I use my https login page on my site the spring security forward is using the wrong port:

https://www.mywebsite.com: 80/j_spring_security_check?j_username = test& j_password = test& _spring_security_remember_me = false

我的登录bean执行以下操作:

My login bean does the following:

    ExternalContext ec = context.getExternalContext();


    String encodedURL = ec.encodeResourceURL(ec.getRequestContextPath() + "/j_spring_security_check?j_username=" + userId + "&j_password=" + password + "&_spring_security_remember_me=" + rememberMe );
    logger.info(encodedURL);
    ec.redirect(encodedURL);

也尝试过:

ExternalContext context = FacesContext.getCurrentInstance()
            .getExternalContext();

    RequestDispatcher dispatcher = ((ServletRequest) context.getRequest())
            .getRequestDispatcher("/j_spring_security_check");

    dispatcher.forward((ServletRequest) context.getRequest(),
            (ServletResponse) context.getResponse());

    FacesContext.getCurrentInstance().responseComplete();
    // It's OK to return null here because Faces is just going to exit.
    return null;

Server.xml:

Server.xml:

<Connector port="80" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
            redirectPort="443" />

<Connector port="443" protocol="HTTP/1.1" scheme="https" secure="true"/>

不确定为什么使用错误的端口...

Not sure why its using the wrong port...

推荐答案

<Connector port="443" protocol="HTTP/1.1" scheme="https" secure="true"/>更改为 <Connector port="443" proxyPort="443" protocol="HTTP/1.1" scheme="https" secure="true"/>并且有效

这篇关于Spring Security Https错误端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆