Skip to content

CORS #6

Open
Open

Description

@asu126
Failed to load http://localhost:8080/api/user: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. The response had HTTP status code 405. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Activity

  1. asu126 commented on Jul 30, 2018

    @asu126
    OwnerAuthor
     return axios(url, {
          method: 'GET',
          mode: 'no-cors',
          headers: {
            'Access-Control-Allow-Origin': '*',
            'Content-Type': 'application/json',
          },
          withCredentials: true,
          credentials: 'same-origin',
        }).then(response => {
        })
    
  2. asu126 commented on Aug 1, 2018

    @asu126
    OwnerAuthor

    http://www.ruanyifeng.com/blog/2016/04/cors.html

    reponse:

    Access-Control-Allow-Origin: http://localhost:8081
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Connection: close
    Content-Type: application/json;charset=UTF-8
    Date: Wed, 01 Aug 2018 13:16:29 GMT
    Expires: 0
    Pragma: no-cache
    Transfer-Encoding: chunked
    Vary: Origin
    Vary: Access-Control-Request-Method
    Vary: Access-Control-Request-Headers
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-XSS-Protection: 1; mode=block
    

    request

    Accept: */*
    Accept-Encoding: gzip, deflate, br
    Accept-Language: zh-CN,zh;q=0.9
    Access-Control-Allow-Origin: http://localhost:8081
    Connection: keep-alive
    Content-Length: 10
    Content-Type: application/x-www-form-urlencoded
    Host: localhost:8080
    Origin: http://localhost:8081
    Referer: http://localhost:8081/users
    User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
    
  3. asu126 commented on Aug 13, 2018

    @asu126
    OwnerAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions