Skip to content
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

reverse-proxy-nginx.conf: switch to cached endpoint by default #6833

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion e2e/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ module.exports = defineConfig({
env: {
PRINT_URL: 'http://localhost:3000/print',
API_ROOT_URL: 'http://localhost:3000/api',
API_ROOT_URL_CACHED: 'http://localhost:3004',
},
})
8 changes: 4 additions & 4 deletions e2e/specs/httpCache.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('HTTP cache tests', () => {
cy.login('[email protected]')

// first request is a cache miss
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers.xkey).to.eq(
'a4211c11211c c462edd869f3 5e2028c55ee4 a4211c112939 f17470519474 1a0f84e322c8 3ef17bd1df72 4f0c657fecef 44dcc7493c65 cfccaecd4bad 318e064ea0c9 /api/content_types'
Expand All @@ -32,7 +32,7 @@ describe('HTTP cache tests', () => {
cy.login('[email protected]')

// first request is a cache miss
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers.xkey).to.eq('318e064ea0c9')
expect(headers['x-cache']).to.eq('MISS')
Expand All @@ -52,7 +52,7 @@ describe('HTTP cache tests', () => {
cy.login('[email protected]')

// first request is a cache miss
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers.xkey).to.eq(
/* campCollaboration for [email protected] */
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('HTTP cache tests', () => {
// ensure cache was invalidated
cy.login('[email protected]')
cy.request({
url: Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal',
url: `${uri}.jsonhal`,
failOnStatusCode: false,
}).then((response) => {
expect(response.status).to.eq(404)
Expand Down
12 changes: 6 additions & 6 deletions e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ Cypress.Commands.add('moveDownloads', () => {
})

Cypress.Commands.add('expectCacheHit', (uri) => {
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers['x-cache']).to.eq('HIT')
})
})

Cypress.Commands.add('expectCacheMiss', (uri) => {
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers['x-cache']).to.eq('MISS')
})
})

Cypress.Commands.add('expectCachePass', (uri) => {
cy.request(Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal').then((response) => {
cy.request(`${uri}.jsonhal`).then((response) => {
const headers = response.headers
expect(headers['x-cache']).to.eq('PASS')
})
Expand All @@ -62,7 +62,7 @@ Cypress.Commands.add('expectCachePass', (uri) => {
Cypress.Commands.add('apiPatch', (uri, body) => {
cy.request({
method: 'PATCH',
url: Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal',
url: `${uri}.jsonhal`,
body,
headers: {
'Content-Type': 'application/merge-patch+json',
Expand All @@ -73,7 +73,7 @@ Cypress.Commands.add('apiPatch', (uri, body) => {
Cypress.Commands.add('apiPost', (uri, body) => {
cy.request({
method: 'POST',
url: Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal',
url: `${uri}.jsonhal`,
body,
headers: {
'Content-Type': 'application/hal+json',
Expand All @@ -84,6 +84,6 @@ Cypress.Commands.add('apiPost', (uri, body) => {
Cypress.Commands.add('apiDelete', (uri) => {
cy.request({
method: 'DELETE',
url: Cypress.env('API_ROOT_URL_CACHED') + uri + '.jsonhal',
url: `${uri}.jsonhal`,
})
})
4 changes: 2 additions & 2 deletions reverse-proxy-nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ http {
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_set_header X-Forwarded-Prefix /api;
proxy_pass http://api:3001/;
proxy_pass http://http-cache:8080/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
Expand Down Expand Up @@ -78,7 +78,7 @@ http {
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_set_header X-Forwarded-Prefix /api;
proxy_pass http://http-cache:8080/;
proxy_pass http://api:3001/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
Expand Down