Search code examples
sslhttp-redirectstrutsstruts-1

How will Struts ActionForward redirect know if it has to redirect to http or https?


I am seeing mix content redirection error from https to http when I am doing new ActionForward. I am not able to figure out what ActionForward reads in order to determine that it has to go to http instead of https. I have old Struts v1.11.


Solution

  • The ActionConfig I suppose, but it's available via extension to Struts.

    An extension to version 1.1, named sslext, helps solve many of the HTTP/HTTPS switching issues. It extends the ActionConfig class, RequestProcessor, and Plugin classes to define a framework where developers may specify the transmission protocol behavior for Struts applications. Within the Struts configuration file, developers specify which action requests require HTTPS transmission and which should use HTTP. Developers can also specify whether to redirect "improperly-protocoled" requests to the correct protocol.

    In addition to these extensions, the <html:link> and the <html:form> tags have been extended. In these extensions, the Struts actions specified in either of these tags are analyzed to determine the protocol that should be used in requesting that action. The HTML generated by these tags will specify the proper protocol. An additional custom tag is defined for allowing users to specify the transmission protocol for an individual JSP. This is most often used for form-based authentication pages.