Skip to content

Commit

Permalink
Merge pull request #129 from forza-mor-rotterdam/anti-cache-headers
Browse files Browse the repository at this point in the history
#MOR-13: anti cache headers
  • Loading branch information
mguikema authored Sep 23, 2024
2 parents f0a5507 + c464dc3 commit 41a38b9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ jobs:
type=raw,develop
type=raw,test
- name: Extract metadata (tags, labels) for Docker nginx
id: meta_nginx
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx
tags: |
type=raw,develop
type=raw,test
- name: Build and push app Docker image
uses: docker/build-push-action@v3
with:
Expand All @@ -84,6 +93,14 @@ jobs:
GIT_SHA=${{ github.sha }}
DEPLOY_DATE=${{ steps.get_date.outputs.DATE }}
- name: Build and push nginx Docker image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:nginx"
push: true
tags: ${{ steps.meta_nginx.outputs.tags }}
labels: ${{ steps.meta_nginx.outputs.labels }}

deploy-acc:
name: Acceptance release
if: github.ref == 'refs/heads/develop'
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deploy-prd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app

- name: Extract metadata (tags, labels) for Docker nginx
id: meta_nginx
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-nginx

- name: Build and push app Docker image
uses: docker/build-push-action@v3
with:
Expand All @@ -46,6 +52,14 @@ jobs:
build-args: |
GIT_SHA=${{ github.sha }}
- name: Build and push nginx Docker image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:nginx"
push: true
tags: ${{ steps.meta_nginx.outputs.tags }}
labels: ${{ steps.meta_nginx.outputs.labels }}

- name: Start rollout on k8s platform
uses: actions-hub/kubectl@master
env:
Expand Down
7 changes: 6 additions & 1 deletion nginx/nginx-default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ server {

location / {
proxy_pass http://localhost:8000;
expires 0;
add_header Cache-Control "no-cache, no-store";
add_header Pragma no-cache;
}

location /media-protected {
internal;
alias /media/;
access_log off;
expires 30d;
add_header Vary Accept-Encoding;
expires 0;
add_header Cache-Control "no-cache, no-store";
add_header Pragma no-cache;
}

location /static {
Expand Down
7 changes: 6 additions & 1 deletion nginx/nginx-default.development.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ server {

location / {
proxy_pass http://mbc_app:8000;
expires 0;
add_header Cache-Control "no-cache, no-store";
add_header Pragma no-cache;
}

location /media-protected {
internal;
alias /media/;
access_log off;
expires 30d;
add_header Vary Accept-Encoding;
expires 0;
add_header Cache-Control "no-cache, no-store";
add_header Pragma no-cache;
}

location /static {
Expand Down

0 comments on commit 41a38b9

Please sign in to comment.