5

Web アプリケーションで Spring Secutiry フレームワークを使用しています。SSL 証明書をインストールし、 経由でアプリケーションにアクセスできますhttpsrequires-channel="https"ここで、すべてのディレクティブに属性を追加するとintercept-url、サーバーは次のように応答します。

Error 310 (net::ERR_TOO_MANY_REDIRECTS) to many connections

春は毎回このコードを実行します:

64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.FilterChainProxy  - / at position 1 of 12 in additional filter chain; firing Filter: 'ChannelProcessingFilter'
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.util.AntPathRequestMatcher  - Checking match of request : '/'; against '/'
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.access.channel.ChannelProcessingFilter  - Request: FilterInvocation: URL: /; ConfigAttributes: [REQUIRES_SECURE_CHANNEL]
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint  - Redirecting to: https://sky-handling.ejl-group.com/
64050 [http-bio-8080-exec-1] DEBUG org.springframework.security.web.DefaultRedirectStrategy  - Redirecting to 'https://sub.domain.com/'

どうすれば解決できますか?

ありがとうございました

更新番号 1:

<http use-expressions="true">
  <form-login login-page="/wellcome/" login-processing-url="/login" default-target-url="/" always-use-default-target="false"
            authentication-failure-url="/wellcome/?error=1" username-parameter="email" password-parameter="password" />
  <remember-me key="temp" token-validity-seconds="-1" />
  <logout invalidate-session="true" logout-success-url="/" logout-url="/logout"/>
  <intercept-url pattern="/" access="authenticated"/>
  <intercept-url pattern="/administration/**" access="authenticated"/>
  <intercept-url pattern="/wellcome/" access="permitAll"/>
  <intercept-url pattern="/login" access="permitAll"/>
  <custom-filter ref="ajaxTimeoutRedirectFilter" after="EXCEPTION_TRANSLATION_FILTER"/>
</http>

既存の証明書をキーストアにインポートし、Tomcat を構成しましたが、そのような行を追加すると:

<VirtualHost _default_:443>
        SSLEngine on
        SSLCertificateFile /usr/local/ssl/crt/public.crt
        SSLCertificateKeyFile /usr/local/ssl/private/*.ejl-group.com.key
        SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt
        ServerName sub.domain.com
        ProxyRequests Off
        ProxyPreserveHost On
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyPass / http://localhost:8443/
        ProxyPassReverse / http://localhost:8443/
</VirtualHost>

503 Service Temporarily Unavailableエラーで失敗します

4

2 に答える 2

5

security.xml ファイルにポートマッピングを追加して、これを修正しました。

<http>
   <port-mappings>
        <port-mapping http="8088" https="8443"/>
        <port-mapping http="80" https="443"/>
   </port-mappings>
</http>

このブログが役に立ちました: http://consultingblogs.emc.com/richardtiffin/archive/2010/10/15/applying-ssl-to-a-spring-web-application-on-tomcat.aspx

また、ロードバランサーの背後にいる場合は、いくつかのコードを追加する必要があります: Spring Security を使用して https をロードバランサーにオフロードする

于 2013-04-17T20:46:12.950 に答える
1

次の 2 行が鍵だと思います。

    ProxyPass / http://localhost:8443/
    ProxyPassReverse / http://localhost:8443/

ここでは、https ではなく http を指定していることに注意してください。つまり、クライアントがデフォルトの HTTPS ポート (443) を介して Web サイトにアクセスすると、httpd は http スキームを使用してリクエストを tomcat インスタンスに転送します。次に、Tomcat は HTTPS/443 ポートへのリダイレクトを試み、次に httpd は http スキームなどを使用してリクエストを Tomcat インスタンスに転送します。

スキームを https に変更するだけではうまくいくかどうかわかりませんが、試してみてください。

あなたのセキュリティ要件については知りませんが、通常、httpd フロントエンドと tomcat バックエンドの間に SSL で保護されたリンクを設ける必要はありません。ここでは単純な HTTP の使用を検討するか、AJP を使用することもできます

于 2013-01-20T19:29:24.093 に答える