Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: dev audit cover cover-html fmt lint pre-commit run test tidy update-deps
.PHONY: dev audit cover cover-html fmt lint pre-commit test tidy update-deps

.DEFAULT: help
help:
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@ go get github.com/alexferl/echo-secure
package main

import (
"net/http"
"net/http"

"github.com/alexferl/echo-secure"
"github.com/labstack/echo/v4"
"github.com/alexferl/echo-secure"
"github.com/labstack/echo/v4"
)

func main() {
e := echo.New()
e := echo.New()

e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "ok")
})
e.Use(secure.New())

e.Use(secure.New())
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "hello")
})

e.Logger.Fatal(e.Start("localhost:1323"))
e.Logger.Fatal(e.Start("localhost:1323"))
}
```

```shell
http http://127.0.0.1:1323
HTTP/1.1 200 OK
Content-Length: 2
Content-Length: 5
Content-Security-Policy: default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; base-uri 'self'; form-action 'self';
Content-Type: text/plain; charset=UTF-8
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Date: Tue, 01 Apr 2025 02:17:23 GMT
Date: Tue, 01 Apr 2025 02:29:34 GMT
Permissions-Policy: accelerometer=(), autoplay=(), camera=(), cross-origin-isolated=(), display-capture=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), keyboard-map=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

ok
hello
```

### Configuration
Expand Down