Skip to content

Instantly share code, notes, and snippets.

@alexanderkiel
Created July 16, 2019 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexanderkiel/fbcebc83dfb337929d0420adab726f13 to your computer and use it in GitHub Desktop.
Save alexanderkiel/fbcebc83dfb337929d0420adab726f13 to your computer and use it in GitHub Desktop.
proxy_cache_path /tmp/nginx keys_zone=FHIR:10m;
# our origin server with added Cache-Control headers since HAPI has none
server {
listen 8080;
location / {
proxy_pass http://hapi.fhir.org/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cache-Control "public, must-revalidate, max-age=1";
# uncomment to add a Vary header to the origin server
# add_header Vary "accept, accept-encoding";
}
}
# our caching reverse proxy
server {
listen 8081;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache FHIR;
proxy_cache_revalidate on;
add_header X-Proxy-Cache $upstream_cache_status;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment