我的Spring 4 MVC外部URL重定向出现奇怪的行为。可以通过http和https协议访问我的应用程序。我正在尝试重定向到https://www.surveymonkey.com/r/xxxx?a=abc&b=bcd,但是由于某些原因,该应用程序正在内部重定向到https://my_host_here/r/xxxx?a=abc&b=bcd。仅当通过https协议访问我的应用程序时,才会出现此问题。也就是说,当通过http协议访问我的应用程序时,外部重定向可以很好地工作到url(https://www.surveymonkey.com/r/xxxx?a=abc&b=bcd)。
我正在使用Spring 4和Thymeleaf 3。 这就是我在控制器中进行重定向的方式:
return "redirect:"+ url;
下面是我的viewresolver的配置
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<property name="prefix" value="/WEB-INF/templates/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
</bean>
<bean id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
</bean>
<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine" />
</bean>
我登录并验证了该网址为https://www.surveymonkey.com/r/xxxx?a=abc&b=bcd,并且我不认为该网址是原因,因为如上所述,当通过http而不是https访问我的应用程序时,它可以正常工作。 / p>