Enabling CORS Filter

Enabling CORS Filter

Configuring CORS Settings in AutomationEdge

Info
For Version 7.x

Follow these steps to enable CORS:

  1. Stop the Tomcat Service

    • Stop the Tomcat service to safely apply configuration changes.
  2. Navigate to Configuration Folder

    • Go to the directory:
      Your Drive:\AutomationEdge\tools\apache-tomcat\webapps\aeengine\WEB-INF
  3. Modify the web.xml File

    • Open the web.xml file in a text editor.
    • Locate the commented section related to CorsFilter.
    • Uncomment the following section to enable the filter:
      <!-- Enable following CorsFilter if aeui and aeengine are going to get deployed on different web servers -->
      <!-- <filter>
      <filter-name>CorsFilter</filter-name>
      <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
      <init-param>
      <param-name>cors.allowed.origins</param-name>
      <param-value>*</param-value>
      </init-param>
      <init-param>
      <param-name>cors.allowed.methods</param-name>
      <param-value>GET,POST,PUT,DELETE</param-value>
      </init-param>
      <init-param>
      <param-name>cors.allowed.headers</param-name>
      <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,X-session-token</param-value>
      </init-param>
      </filter>
      <filter-mapping>
      <filter-name>CorsFilter</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping> -->
  4. Start the Tomcat Service

    • Restart the Tomcat service to apply the changes.

Info
For Version 8.x

Follow these steps to enable CORS:

  1. Stop the Tomcat Service

    • Stop the Tomcat service to safely apply configuration changes.
  2. Navigate to Configuration Folder

    • Go to the directory:
      Your Drive:\AutomationEdge\aehome\conf
  3. Modify the ae.properties File

    • Open the ae.properties file in a text editor.
    • Add the following configuration for enabling CORS:
      # Allow OPTIONS method for CORS
      spring.security.web.firewall.allowed-http-methods=GET,POST,PUT,DELETE,OPTIONS # Enable CORS endpoints.web.cors.enabled=true endpoints.web.cors.allowed-origins=* endpoints.web.cors.allowed-methods=GET,POST,PUT,DELETE endpoints.web.cors.allowed-headers=Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,X-session-token


  4. Start the Tomcat Service

    • Restart the Tomcat service to apply the changes.


Notes
Notes

  • Ensure you have appropriate permissions to edit the configuration files.
  • Always take a backup of configuration files before making any changes.
  • Kindly try the same on UAT first.

      Links to better reach 

            Bot Store

             EPD