Code Monkey home page Code Monkey logo

projector-hsa-08's Introduction

projector-hsa-08 Web Servers

How to launch

Execute docker compose up --build and that's all, after that service can be accessed on http://localhost:8080 (nginx)

Open in browser:

http://localhost:8080/assets/image.png

You should see the image in the browser and corresponding requests logs from server;

On the third request you shouldn`t see any request logs, meaning that nginx cached the image;

projector-hsa-08-proxy-1      | 2023/11/13 23:03:57 [notice] 1#1: start cache loader process 45
projector-hsa-08-go-server-1  | 2023/11/13 23:04:01 main.go:53: 192.168.64.3:42416 GET /assets/image.png
projector-hsa-08-proxy-1      | 192.168.64.1 - - [13/Nov/2023:23:04:01 +0000] "GET /assets/image.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "-"
projector-hsa-08-go-server-1  | 2023/11/13 23:04:03 main.go:53: 192.168.64.3:42432 GET /assets/image.png
projector-hsa-08-proxy-1      | 192.168.64.1 - - [13/Nov/2023:23:04:03 +0000] "GET /assets/image.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "-"
projector-hsa-08-proxy-1      | 192.168.64.1 - - [13/Nov/2023:23:04:06 +0000] "GET /assets/image.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "-"
projector-hsa-08-proxy-1      | 192.168.64.1 - - [13/Nov/2023:23:04:07 +0000] "GET /assets/image.png HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "-"

To reset the cache you can manually rename the image in the assets folder and call:

curl http://localhost:8080/assets/image.png --header 'Cache-Purge: true' -I

As a result you should see BYPASS value in Cache header and corresponding request log to the server;

HTTP/1.1 200 OK
Server: nginx/1.25.2
Date: Mon, 13 Nov 2023 23:04:54 GMT
Content-Type: image/png
Content-Length: 3468
Connection: keep-alive
Last-Modified: Mon, 13 Nov 2023 13:30:15 GMT
Cache: BYPASS
Accept-Ranges: bytes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.