V2: redirect /path to /path/ with assets

Yeah, you’re probably right. It’s a bit tricky because the actual expanded structure in the resulting JSON depends on whether the user specifies a matcher or not.

FYI, we’re working on some improvements to php_fastcgi so that the internal structure of it can be overridden with some options. If merged, it’ll probably only be available in v2.1

1 Like

That’s actually a pretty good idea. I guess that’s technically more accurate than leaving them as normal/separate directives.

Good thing I saw this post. I thought I was alone. My issue was that I did not put the file_server option. So in the beginning it looked like this

https://thedeveloper.club {
tls emai@gmail.com
encode zstd gzip
root * /var/www/
@cachedFiles {
path *.jpg *.jpeg *.png *.gif *.ico *.js *.css *.html *.svg *.ttf *.webp *.woff2 *.woff
}
try_files {path} {path}/index.php
header @cachedFiles Cache-Control “public, max-age=604800, must-revalidate”
php_fastcgi localhost:9000
}

but after updating it it looked like this

https://thedeveloper.club {
tls emai@gmail.com
encode zstd gzip
root * /var/www/
@cachedFiles {
path *.jpg *.jpeg *.png *.gif *.ico *.js *.css *.html *.svg *.ttf *.webp *.woff2 *.woff
}
try_files {path} {path}/index.php
file_server
header @cachedFiles Cache-Control “public, max-age=604800, must-revalidate”
php_fastcgi localhost:9000
}

Now it works. I also learned that if the file_server is there and I add the slah in php_fastcgi it will show the whole code, including PHP code. Like so:

php_fastcgi / localhost:9000

Am just learning the new version 2 format. Having fun.

That’s because in v2, path matchers are exact-match. Omitting the / makes it default to *. If you put just / then it only matches requests to /. Typically you append * to the end of the path matcher. For example /api*

2 Likes

Thank you Francis, this opens up a whole new world of possibilities. A new fantastic point of view, where the system will not tell you No, or where to go, or deny what we could be dreaming.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.