Use absolute paths
This commit is contained in:
parent
65e103fd23
commit
05527e41b7
@ -24,7 +24,7 @@
|
||||
<link rel="preload" href="/font/RobotoMono-Bold.woff2" as="font" type="font/woff2" crossorigin>
|
||||
|
||||
<% if cssPath != "" { %>
|
||||
<link href="<%== cssPath %>" rel="stylesheet">
|
||||
<link href="/<%== cssPath %>" rel="stylesheet">
|
||||
<% } %>
|
||||
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
@ -34,7 +34,7 @@
|
||||
<div id="root"></div>
|
||||
|
||||
<% for _, script := range scripts { %>
|
||||
<script src="<%== script %>"></script>
|
||||
<script src="/<%== script %>"></script>
|
||||
<% } %>
|
||||
|
||||
<noscript>This page needs JavaScript enabled to function.</noscript>
|
||||
|
@ -11,13 +11,13 @@ io.WriteString(w, "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\
|
||||
io.WriteString(w, inlineScript )
|
||||
io.WriteString(w, "</script><link rel=\"preload\" href=\"/font/fontello.woff2?48901973\" as=\"font\" type=\"font/woff2\" crossorigin><link rel=\"preload\" href=\"/font/RobotoMono-Regular.woff2\" as=\"font\" type=\"font/woff2\" crossorigin><link rel=\"preload\" href=\"/font/Montserrat-Regular.woff2\" as=\"font\" type=\"font/woff2\" crossorigin><link rel=\"preload\" href=\"/font/Montserrat-Bold.woff2\" as=\"font\" type=\"font/woff2\" crossorigin><link rel=\"preload\" href=\"/font/RobotoMono-Bold.woff2\" as=\"font\" type=\"font/woff2\" crossorigin>")
|
||||
if cssPath != "" {
|
||||
io.WriteString(w, "<link href=\"")
|
||||
io.WriteString(w, "<link href=\"/")
|
||||
io.WriteString(w, cssPath )
|
||||
io.WriteString(w, "\" rel=\"stylesheet\">")
|
||||
}
|
||||
io.WriteString(w, "<link rel=\"manifest\" href=\"/manifest.json\"></head><body><div id=\"root\"></div>")
|
||||
for _, script := range scripts {
|
||||
io.WriteString(w, "<script src=\"")
|
||||
io.WriteString(w, "<script src=\"/")
|
||||
io.WriteString(w, script )
|
||||
io.WriteString(w, "\"></script>")
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ func (d *Dispatch) initFileServer() {
|
||||
}
|
||||
|
||||
file := &File{
|
||||
Path: assetName,
|
||||
Path: "/" + assetName,
|
||||
Asset: asset,
|
||||
ContentType: contentTypes[filepath.Ext(assetName)],
|
||||
CacheControl: longCacheControl,
|
||||
@ -235,7 +235,7 @@ func (d *Dispatch) serveFiles(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if strings.HasSuffix(r.URL.Path, file.Path) {
|
||||
if r.URL.Path == file.Path {
|
||||
d.serveFile(w, r, file)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user