I deployed a Firebase application consisted on one function and a bunch of static files in the public directory that build up the site itself.
The firebase.json
contains one redirect rule and one rewrite rule.
Strangely, when testing the function locally, I can't see any problem at all, the static index.html
file is loaded with the corresponding css and js files stored under the folder /assets
.
But when I deploy the application in the Firebase hosting, all the files under that specific directory (/assets) return an HTTP/2 500
with some extra headers like location
pointing to themselves.
I can't see the logs for anything else apart from the functions (that are not even being called), so I can't get to troubleshoot this issue.
Any idea?
The full HTTP response when curl
'ed one of the css files is like this:
< HTTP/2 500
< server: nginx
< content-type: text/html; charset=utf-8
< location: /assets/css/bootstrap.min.css
< etag: W/"2c-Fy5LxM6AQUiWl2dvoMk+v0DAv6s"
< fastly-restarts: 1
< accept-ranges: bytes
< date: Mon, 08 Apr 2019 10:31:34 GMT
< via: 1.1 varnish
< x-served-by: cache-lcy19235-LCY
< x-cache: MISS
< x-cache-hits: 0
< x-timer: S1554719494.752454,VS0,VE252
< vary: x-fh-requested-host
< content-length: 44
<
<!doctype html>
<html>
<head>
* Connection #0 to host [REDACTED] left intact
<title>U
That's the full response that gets truncated there after the U
.
Let me reply to myself, as I found what the problem was but I found NOTHING on internet about this specific issue.
Due to my lack of expertise on Firebase, I realised that my redirect rule was breaking the application, as it was redirecting all the files under /assets
to themselves, but instead of getting a redirect loop, I was getting this weird behaviour.
Again, locally was working with no problem, but when deployed, the HTTP/2 500
error appeared.
This was the rule, just in case this helps someone in the future to solve this specific issue:
"redirects":[
{
"source": "/assets/:path*",
"destination": "/assets/:path",
}
]