Rest Service Trouble Shooter
  • 21 Mar 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Rest Service Trouble Shooter

  • Dark
    Light

Article summary

Rest Service Trouble Shooter

This page have information about problems with Rest-services.

CORS Policy

Problem

A Rest Service in Comflow, worked in Postman and executed correctly, but in a web browser returns and error about CORS:

“Access to XMLHttpRequest at 'http://localhost:9090/comflow/rs/authentication/authenticate' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response”

 Solution

Edit web.xml to remove x-frame-option. - However, you may put the application at risk for click jacking!

<filter>

        <filter-name>httpHeaderSecurity</filter-name>

        <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>

            <init-param>

                  <param-name>antiClickJackingEnabled</param-name>

                  <param-value>true</param-value>

            </init-param>    

            <init-param>

                  <param-name>antiClickJackingOption</param-name>

                  <param-value>SAMEORIGIN</param-value>

            </init-param> 

    </filter>



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.