Add Nginx Server Rewrite

I want to add a server rewrite to Nginx:
location / {
try_files /cache/blitz/$http_host/$uri/$args/index.html $uri $uri/ /index.php?$query_string;
}
Currently, do we support adding it using Web configuration?

0

Comments

3 comments
Date Votes
  • The way to do that would be with a rule in your web.locations block. There’s an example in the docs here:

    https://docs.platform.sh/configuration/app/web.html#how-can-i-rewrite-an-incoming-request-without-a-redirect

    0
  • Is there a way to rewrite URLs to static files as well?

    For example, I’d like to implement cache-busting by rewriting

    /path/file.hash.js => /path/file.js
    

    I tried the following, but kept getting 404:

    rules:
      '(?<file>.*)\.\w{8}\.js$':
        passthru: '/$file.js'
    
    0
  • @bao-tran did you work out how to achieve this on Platform.sh. We are also looking to set up Blitz caching.

    Any help would be greatly appreciated. Thanks.

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post