5

Using nginx as a reverse proxy, I'd like to mimic the index directive with proxy_pass. Therefore I'd like nginx to query /index.html instead of /, /sub/index.html instead of /sub/.

What would be the best approach to do this ?

Not sure if it's relevant, but the proxied server does answer HTTP 200 on /, but I'd still like to rewrite it to /index.html.

As the / request leaks some information by listing the directory content, I'd also like to be sure that no one will be capable of accessing it (like doing something like /sub/..).

Thanksies

1 Answer 1

5

Just add :

rewrite (.*)/$ $1/index.html last;
rewrite (.*)/..$ $1/../index.html last;

Should works

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.