New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[management-api] The API version is outdated and must be refreshed (current modifications will be lose) #1079

Closed
chicco785 opened this Issue Feb 14, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@chicco785

chicco785 commented Feb 14, 2018

Expected Behavior

  1. When I am updating an API, the API is update correctly.

Current Behavior

  1. Any change i made to any API, I get the following error: "The API version is outdated and must be refreshed (current modifications will be lose)"

Steps to Reproduce (for bugs)

  1. Create an API
  2. Try to update it.
  3. This is the request sent to the API:
Request URL:https://api-manager-dev.s.orchestracities.com/management/apis/081729ff-43c9-4087-9729-ff43c9108744?action=STOP
Request Method:POST
Status Code:412 Precondition Failed
Remote Address:18.195.222.102:443
Referrer Policy:no-referrer-when-downgrade

Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9,it-IT;q=0.8,it;q=0.7
Cache-Control:no-cache
Connection:keep-alive
Content-Length:2
Content-Type:application/json;charset=UTF-8
Cookie:_ga=GA1.2.1802221871.1517409476; cookie_notice_accepted=true; Authorization="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImZpcnN0bmFtZSI6bnVsbCwicGVybWlzc2lvbnMiOlt7ImF1dGhvcml0eSI6IlBPUlRBTDpBRE1JTiJ9LHsiYXV0aG9yaXR5IjoiQURNSU4ifSx7ImF1dGhvcml0eSI6Ik1BTkFHRU1FTlQ6QURNSU4ifV0sImlzcyI6ImdyYXZpdGVlLW1hbmFnZW1lbnQtYXV0aCIsImV4cCI6MTUxOTE4MTE0NywiaWF0IjoxNTE4NTc2MzQ3LCJlbWFpbCI6bnVsbCwianRpIjoiNjBmZjNmMzItN2VlYS00NjFlLThlMGYtZDMyOWEzOTBiYmY5IiwibGFzdG5hbWUiOm51bGx9.tOftY6VtYkmutgDKCFdLR3jR_xjOY9Sx4WR25pkf7yI"
Host:api-manager-dev.s.orchestracities.com
If-Match:W/"-1842025354"
Origin:https://developer-dev.s.orchestracities.com
Pragma:no-cache
Referer:https://developer-dev.s.orchestracities.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-Requested-With:XMLHttpRequest

  1. This is the response:
{
  "message" : "The api version is outdated",
  "http_status" : 412
}

Your Environment

  • Version used: 1.13.2
    Oauth enabled.
    LocalLogin enabled.
@chicco785

This comment has been minimized.

chicco785 commented Feb 14, 2018

With version 1.12.5 everything works fine.

Any clue?

@brasseld

This comment has been minimized.

Member

brasseld commented Feb 14, 2018

You are probably running gravitee with a nginx in front of components.
And gzip encoding is enabled. When gzip is enabled, nginx is changing the Etag response header and cause this issue.
We are working on a solution. You can disable gzip to make it work again.

@brasseld

This comment has been minimized.

Member

brasseld commented Feb 14, 2018

@brasseld brasseld changed the title from The API version is outdated and must be refreshed (current modifications will be lose) to [management-api] The API version is outdated and must be refreshed (current modifications will be lose) Feb 14, 2018

@chicco785

This comment has been minimized.

chicco785 commented Feb 14, 2018

@chicco785

This comment has been minimized.

chicco785 commented Feb 14, 2018

so i disabled gzip, but still it's not working properly.

when i access the an api page, the etag is retrieved from the API:

Request
URL:https://api-manager.s.orchestracities.com/management/apis/c85586b5-a8fe-4521-9586-b5a8fe45217b
Request Method:GET
Status Code:200 OK
Remote Address:18.195.222.102:443
Referrer Policy:no-referrer-when-downgrade

Request Headers:
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9,it-IT;q=0.8,it;q=0.7
Cache-Control:no-cache
Connection:keep-alive
Cookie:_ga=GA1.2.1802221871.1517409476; cookie_notice_accepted=true; Authorization="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJmZWRlcmljby5mYWNjYUBtYXJ0ZWwtaW5ub3ZhdGUuY29tIiwiZmlyc3RuYW1lIjoiRmVkZXJpY28gTWljaGVsZSIsImlzcyI6ImdyYXZpdGVlLW1hbmFnZW1lbnQtYXV0aCIsImV4cCI6MTUxOTIwNjQ1MSwiaWF0IjoxNTE4NjAxNjUxLCJlbWFpbCI6ImZlZGVyaWNvLmZhY2NhQG1hcnRlbC1pbm5vdmF0ZS5jb20iLCJqdGkiOiJiMjQzM2NlNy1kNjhiLTQ5YWUtOTEwZi1jOGE1Y2FmZjg0M2MiLCJsYXN0bmFtZSI6IkZhY2NhIn0._fCRubqpxcOIndo4aPFMFzy7HltNEqWFdLPMKJvIFYg"
Host:api-manager.s.orchestracities.com
Origin:https://developer.s.orchestracities.com
Pragma:no-cache
Referer:https://developer.s.orchestracities.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-Requested-With:XMLHttpRequest

Response Headers:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:https://developer.s.orchestracities.com
Access-Control-Expose-Headers:ETag
Cache-Control:no-cache, no-store, max-age=0, must-revalidate
Connection:keep-alive
Content-Encoding:br
Content-Length:1345
Content-Type:application/json
Date:Wed, 14 Feb 2018 12:27:09 GMT
ETag:W/"-1807469121"
Expires:0
Pragma:no-cache
Server:nginx/1.13.7
Vary:Accept-Encoding
Vary:Origin
X-Content-Type-Options:nosniff
X-Frame-Options:DENY
X-XSS-Protection:1; mode=block

Then, when I stop the API, the retrieved Etag is passed as if-match:

Request Headers:
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9,it-IT;q=0.8,it;q=0.7
Cache-Control:no-cache
Connection:keep-alive
Content-Length:2
Content-Type:application/json;charset=UTF-8
Cookie:_ga=GA1.2.1802221871.1517409476; cookie_notice_accepted=true; Authorization="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJmZWRlcmljby5mYWNjYUBtYXJ0ZWwtaW5ub3ZhdGUuY29tIiwiZmlyc3RuYW1lIjoiRmVkZXJpY28gTWljaGVsZSIsImlzcyI6ImdyYXZpdGVlLW1hbmFnZW1lbnQtYXV0aCIsImV4cCI6MTUxOTIwNjQ1MSwiaWF0IjoxNTE4NjAxNjUxLCJlbWFpbCI6ImZlZGVyaWNvLmZhY2NhQG1hcnRlbC1pbm5vdmF0ZS5jb20iLCJqdGkiOiJiMjQzM2NlNy1kNjhiLTQ5YWUtOTEwZi1jOGE1Y2FmZjg0M2MiLCJsYXN0bmFtZSI6IkZhY2NhIn0._fCRubqpxcOIndo4aPFMFzy7HltNEqWFdLPMKJvIFYg"
Host:api-manager.s.orchestracities.com
If-Match:W/"-1807469121"
Origin:https://developer.s.orchestracities.com
Pragma:no-cache
Referer:https://developer.s.orchestracities.com/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-Requested-With:XMLHttpRequest

Response Headers:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:https://developer.s.orchestracities.com
Access-Control-Expose-Headers:ETag
Cache-Control:no-cache, no-store, max-age=0, must-revalidate
Connection:keep-alive
Content-Length:70
Content-Type:application/json
Date:Wed, 14 Feb 2018 12:31:50 GMT
Expires:0
Pragma:no-cache
Server:nginx/1.13.7
Vary:Origin
X-Content-Type-Options:nosniff
X-Frame-Options:DENY
X-XSS-Protection:1; mode=block

But still the API returns 412 :(

So to see what happens contacting directing the service, i logged in the container and replicated the request:

curl -X POST \
  'http://127.0.0.1:8083/management/apis/c85586b5-a8fe-4521-9586-b5a8fe45217b?action=STOP' \
  -H 'Cache-Control: no-cache' \
  -H 'Cookie: _ga=GA1.2.1802221871.1517409476; cookie_notice_accepted=true; Authorization="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJmZWRlcmljby5mYWNjYUBtYXJ0ZWwtaW5ub3ZhdGUuY29tIiwiZmlyc3RuYW1lIjoiRmVkZXJpY28gTWljaGVsZSIsImlzcyI6ImdyYXZpdGVlLW1hbmFnZW1lbnQtYXV0aCIsImV4cCI6MTUxOTIwNjQ1MSwiaWF0IjoxNTE4NjAxNjUxLCJlbWFpbCI6ImZlZGVyaWNvLmZhY2NhQG1hcnRlbC1pbm5vdmF0ZS5jb20iLCJqdGkiOiJiMjQzM2NlNy1kNjhiLTQ5YWUtOTEwZi1jOGE1Y2FmZjg0M2MiLCJsYXN0bmFtZSI6IkZhY2NhIn0._fCRubqpxcOIndo4aPFMFzy7HltNEqWFdLPMKJvIFYg"' \
  -H 'if-match: W/\"-1807469121\"' \
  -H 'Origin: https://developer.s.orchestracities.com' \
  -v

But still the API returns 412 :(

< HTTP/1.1 412 Precondition Failed
< Access-Control-Allow-Origin: https://developer.s.orchestracities.com
< Vary: Origin
< Access-Control-Expose-Headers: ETag
< Access-Control-Allow-Credentials: true
< Content-Type: application/json
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Length: 70
< 
{
  "message" : "The api version is outdated",
  "http_status" : 412
* Curl_http_done: called premature == 0
* Connection #0 to host 127.0.0.1 left intact
}

So i am not sure NGINX is the problem. Any other hint?

@chicco785

This comment has been minimized.

chicco785 commented Feb 14, 2018

For the time being, I hacked the issue by removing the if-match header via nginx:

proxy_set_header if-match "";

brasseld added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Feb 16, 2018

@brasseld brasseld self-assigned this Feb 16, 2018

@brasseld brasseld added this to the 1.13.3 milestone Feb 16, 2018

aelamrani added a commit to gravitee-io/gravitee-management-rest-api that referenced this issue Feb 16, 2018

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