Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy/proxy.go: disable directory indexes #133

Merged
merged 1 commit into from Apr 14, 2017

Conversation

unclejack
Copy link
Contributor

This PR makes the needed changes to avoid listing directories with static assets.

@unclejack unclejack force-pushed the disable_directory_indexes branch 6 times, most recently from 5466765 to ce23b12 Compare April 13, 2017 23:12
if err != nil {
return nil, err
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one exception we need to make here: /

If the name is /, you can return the file descriptor normally. Otherwise, the UI will not work. 😄

Making this change causes the currently failing test (systemtestSuite.TestUIResponseHeaders) to pass, so we'll need to add another one which hits a different directory like /assets or something.

@dseevr
Copy link
Contributor

dseevr commented Apr 14, 2017

For the test, just add a new test function to basic_test.go and you'll basically just need the equivalent of these two lines: https://github.com/contiv/auth_proxy/blob/master/systemtests/basic_test.go#L107-L108

I'd test that / still works properly (200) and /assets is a 404. Highly doubt this code will ever need to be touched again, but better safe than sorry 😄

@unclejack
Copy link
Contributor Author

@dseevr: I've made all the changes and the CI is green. PTAL

runTest(func(ms *MockServer) {
resp, _ := proxyGet(c, noToken, "/")
c.Assert(resp.StatusCode, Equals, 200)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these tests can be inside the same runTest call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dseevr: I've made the change. PTAL

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
@dseevr dseevr merged commit 0acafd7 into contiv:master Apr 14, 2017
@unclejack unclejack deleted the disable_directory_indexes branch April 14, 2017 18:19
dseevr pushed a commit to dseevr-dev/auth_proxy that referenced this pull request Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants