I need to setup rewrite/redirect for some routes to make gatsby js pages work properly (as per this post). But this configuration just gives me an infinite loop of redirects.

  location /app {
    rewrite ^/app/(.*)$ /app/index.html?redirect=/app/$1 break;
    # return 301 $scheme://$host/app/index.html$request_uri;
    # ^^ doesnt work too

  location / {
    try_files $uri $uri/ =404;

How to properly setup /app/anything -> /app/index.html?extra=anything redirect with nginx for this case?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.