fix(backend-http): resolve url if not cachable
This commit is contained in:
parent
a4f45fa002
commit
3132776f4e
1 changed files with 3 additions and 3 deletions
|
|
@ -48,11 +48,11 @@ func isCachable(rawurl string) bool {
|
||||||
|
|
||||||
func GetFullCachableURL(baseURL string, relativeURL string) (string, bool) {
|
func GetFullCachableURL(baseURL string, relativeURL string) (string, bool) {
|
||||||
if !isRelativeCachable(relativeURL) {
|
if !isRelativeCachable(relativeURL) {
|
||||||
return "", false
|
return relativeURL, false
|
||||||
}
|
}
|
||||||
fullURL := ResolveURL(baseURL, relativeURL)
|
fullURL := ResolveURL(baseURL, relativeURL)
|
||||||
if !isCachable(fullURL) {
|
if !isCachable(fullURL) {
|
||||||
return "", false
|
return fullURL, false
|
||||||
}
|
}
|
||||||
return fullURL, true
|
return fullURL, true
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +77,7 @@ func GetCachePathForAssets(sessionID uint64, rawurl string) string {
|
||||||
func (r *Rewriter) RewriteURL(sessionID uint64, baseURL string, relativeURL string) string {
|
func (r *Rewriter) RewriteURL(sessionID uint64, baseURL string, relativeURL string) string {
|
||||||
fullURL, cachable := GetFullCachableURL(baseURL, relativeURL)
|
fullURL, cachable := GetFullCachableURL(baseURL, relativeURL)
|
||||||
if !cachable {
|
if !cachable {
|
||||||
return relativeURL
|
return fullURL
|
||||||
}
|
}
|
||||||
|
|
||||||
u := url.URL{
|
u := url.URL{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue