<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Enable HSTS in hybris port 9002 in CRM and CX Q&amp;A</title>
    <link>https://community.sap.com/t5/crm-and-cx-q-a/enable-hsts-in-hybris-port-9002/qaa-p/12239950#M423729</link>
    <description>&lt;P&gt;You should include a new security filter in the BackOffice flow using web-fragments, which will be merged from all *backoffie extensions. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;gt;&amp;gt; BackofficeSecurityHeaderFilter.java

New filter class with below code : 
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
{
      HttpServletResponse response = (HttpServletResponse) servletResponse;
      response.addHeader("Strict-Transport-Security", "max-age=31556926; includeSubDomains");

      filterChain.doFilter(servletRequest, response);
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;gt;&amp;gt; resources/web-fragment.xml

&amp;lt;web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        &lt;A href="http://java.sun.com/xml/ns/javaee" target="test_blank"&gt;http://java.sun.com/xml/ns/javaee&lt;/A&gt; &lt;A href="http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd&amp;quot;" target="test_blank"&gt;http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"&lt;/A&gt;;
	version="3.0"&amp;gt;
	&amp;lt;name&amp;gt;webfragment_BackofficeSecurityHeaderFilter&amp;lt;/name&amp;gt;
	&amp;lt;filter&amp;gt;
		&amp;lt;filter-name&amp;gt;BackofficeSecurityHeaderFilter&amp;lt;/filter-name&amp;gt;
		&amp;lt;filter-class&amp;gt;&amp;lt;package&amp;gt;.BackofficeSecurityHeaderFilter&amp;lt;/filter-class&amp;gt;
		&amp;lt;async-supported&amp;gt;true&amp;lt;/async-supported&amp;gt;
	&amp;lt;/filter&amp;gt;
	&amp;lt;filter-mapping&amp;gt;
		&amp;lt;filter-name&amp;gt;BackofficeSecurityHeaderFilter&amp;lt;/filter-name&amp;gt;
		&amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
	&amp;lt;/filter-mapping&amp;gt;
&amp;lt;/web-fragment&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 05 Jan 2021 07:29:48 GMT</pubDate>
    <dc:creator>pavan_joshi1</dc:creator>
    <dc:date>2021-01-05T07:29:48Z</dc:date>
    <item>
      <title>Enable HSTS in hybris port 9002</title>
      <link>https://community.sap.com/t5/crm-and-cx-q-a/enable-hsts-in-hybris-port-9002/qaq-p/12239949</link>
      <description>&lt;P&gt;When I access &lt;A href="https://localhost:9002/hac" target="test_blank"&gt;https://localhost:9002/hac&lt;/A&gt; or &lt;A href="https://localhost:9002/backoffice" target="test_blank"&gt;https://localhost:9002/backoffice&lt;/A&gt;, HTTP Strict Transport Security (HSTS) is not in the response header.&lt;/P&gt;
  &lt;P&gt;Any one know where to add this in hybris?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 06:58:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/crm-and-cx-q-a/enable-hsts-in-hybris-port-9002/qaq-p/12239949</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-12-01T06:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Enable HSTS in hybris port 9002</title>
      <link>https://community.sap.com/t5/crm-and-cx-q-a/enable-hsts-in-hybris-port-9002/qaa-p/12239950#M423729</link>
      <description>&lt;P&gt;You should include a new security filter in the BackOffice flow using web-fragments, which will be merged from all *backoffie extensions. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;gt;&amp;gt; BackofficeSecurityHeaderFilter.java

New filter class with below code : 
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
{
      HttpServletResponse response = (HttpServletResponse) servletResponse;
      response.addHeader("Strict-Transport-Security", "max-age=31556926; includeSubDomains");

      filterChain.doFilter(servletRequest, response);
}&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;gt;&amp;gt; resources/web-fragment.xml

&amp;lt;web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        &lt;A href="http://java.sun.com/xml/ns/javaee" target="test_blank"&gt;http://java.sun.com/xml/ns/javaee&lt;/A&gt; &lt;A href="http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd&amp;quot;" target="test_blank"&gt;http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"&lt;/A&gt;;
	version="3.0"&amp;gt;
	&amp;lt;name&amp;gt;webfragment_BackofficeSecurityHeaderFilter&amp;lt;/name&amp;gt;
	&amp;lt;filter&amp;gt;
		&amp;lt;filter-name&amp;gt;BackofficeSecurityHeaderFilter&amp;lt;/filter-name&amp;gt;
		&amp;lt;filter-class&amp;gt;&amp;lt;package&amp;gt;.BackofficeSecurityHeaderFilter&amp;lt;/filter-class&amp;gt;
		&amp;lt;async-supported&amp;gt;true&amp;lt;/async-supported&amp;gt;
	&amp;lt;/filter&amp;gt;
	&amp;lt;filter-mapping&amp;gt;
		&amp;lt;filter-name&amp;gt;BackofficeSecurityHeaderFilter&amp;lt;/filter-name&amp;gt;
		&amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
	&amp;lt;/filter-mapping&amp;gt;
&amp;lt;/web-fragment&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jan 2021 07:29:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/crm-and-cx-q-a/enable-hsts-in-hybris-port-9002/qaa-p/12239950#M423729</guid>
      <dc:creator>pavan_joshi1</dc:creator>
      <dc:date>2021-01-05T07:29:48Z</dc:date>
    </item>
  </channel>
</rss>

