mirror of
https://github.com/safing/portbase
synced 2025-09-04 03:29:59 +00:00
Merge pull request #132 from safing/feature/api-dns-prefetch-header
Disable dns prefetch via HTTP header
This commit is contained in:
commit
2fe8f38ac8
2 changed files with 3 additions and 2 deletions
|
@ -272,7 +272,7 @@ func (e *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// Wait for the owning module to be ready.
|
// Wait for the owning module to be ready.
|
||||||
if !moduleIsReady(e.BelongsTo) {
|
if !moduleIsReady(e.BelongsTo) {
|
||||||
http.Error(w, "The API endpoint not ready yet. Please try again later.", http.StatusServiceUnavailable)
|
http.Error(w, "The API endpoint is not ready yet. Please try again later.", http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error {
|
||||||
// Wait for the owning module to be ready.
|
// Wait for the owning module to be ready.
|
||||||
if moduleHandler, ok := handler.(ModuleHandler); ok {
|
if moduleHandler, ok := handler.(ModuleHandler); ok {
|
||||||
if !moduleIsReady(moduleHandler.BelongsTo()) {
|
if !moduleIsReady(moduleHandler.BelongsTo()) {
|
||||||
http.Error(lrw, "The API endpoint not ready yet. Please try again later.", http.StatusServiceUnavailable)
|
http.Error(lrw, "The API endpoint is not ready yet. Please try again later.", http.StatusServiceUnavailable)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@ func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error {
|
||||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
w.Header().Set("X-Frame-Options", "deny")
|
w.Header().Set("X-Frame-Options", "deny")
|
||||||
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||||
|
w.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||||
} else {
|
} else {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue