title: CORS issue with OPTIONS request
body: <p>I am working on an application built with angular 5 and facing issues with CORS, in order to authorize users I am using jwt token method and send it in headers using jwt.interceptor as follows </p>
  
  <pre><code>export class JwtInterceptor implements HttpInterceptor {
      intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
          // add authorization header with jwt token if available
          let currentUser = JSON.parse(localStorage.getItem('currentUser'));
          if (currentUser &amp;&amp; currentUser.token) {
              request = request.clone({
                  setHeaders: { 
                      Authorization: `Bearer ${currentUser.token}`,
                      Ip:currentUser.Ip
                  }
              });
          }
          return next.handle(request);
      }
  }
  </code></pre>
  
  <p>this code modifies the header and add token/bearer, because of this modification browsers sends preflight OPTIONS requests before actual API, I am using httpclient to send api requestes as follows</p>
  
  <pre><code>merchantDefaultSetup(ipAddress) {
        if(this.access_token != '')
        {
           this.coreService.setMerchantDefaultSetup(this.access_token, ipAddress).subscribe(res =&gt; {this.apiResponse = res},
                                                                           err =&gt; console.log(err),
                                                                           ()  =&gt; this.checkSetMerchantDefaultSetupApiResponse(this.apiResponse)
                                                                          );
        }
        else
        {
          this.router.navigate(["/dashboard"]);
        }
     }
  </code></pre>
  
  <p>and this functions uses following service </p>
  
  <pre><code>public setMerchantDefaultSetup(token, ipAddress)
     {
        let header = new HttpHeaders({'Content-Type': 'application/json', 'Ip': ipAddress});
        return this.http.get&lt;Response&gt;(this.apiUrl+'merchant/default-setup/'+token, {headers: header}).map(response =&gt; response.response);
     }
  </code></pre>
  
  <p>above code works proper when api and app code are on same server but not I have created two ec2 instances on aws to host api and apps separately.</p>
  
  <p>Following is the error I get on api hit </p>
  
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mydomain.mytestsite.com:8080/api/v1/merchant/default-setup/678as6d98a6s8d68. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)
  </code></pre>
  
  <p>REST api are built with golang and running on 8080 port </p>
  
  <p>All the articles gives solution for get,post, put methods but they are working fine in my case unless there is any preflight OPTIONS request</p>
  
  <p>Please help</p>