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

nginx: look for index.html in all paths ending in '/' #15

Closed

Conversation

stepheneb
Copy link
Contributor

See mailing list thread: http://groups.google.com/group/phusion-passenger/browse_thread/thread/58453ce1ea4c60c4

I'm not much of a C programmer ... so I added the bare minimum to get this working for me.

Start to match the behavior of the Apache2 handling of
requests that might be in the pageCache.

If the filename ends with '/' try to serve filename + 'index.html

The Apache2 handler also checks 'index/htm'

Start to match the behavior of the Apache2 handling of
requests that might be in the pageCache.

If the filename ends with '/' try to serve filename + 'index.html

The Apache2 handler also checks 'index/htm'
@stepheneb
Copy link
Contributor Author

I'd like to see this merged into Passenger or have some feedback about what needs to be changed or why it won't get merged.

Thanks

@ippa
Copy link

ippa commented Aug 30, 2011

Is this issue getting some love? I'm getting hit by the same thing. My sinatra-app on nginx/passenger:

http://jawsjs.com/docs/index.html <-- works
http://jawsjs.com/docs/ <-- doesn't work

It seems I can't get it to work no matter what combination of "index index.html", "location" and "passenger_enabled" I try in my nginx.conf.

@ippa
Copy link

ippa commented Aug 30, 2011

Found this, and it seems to work: https://gist.github.com/547977

@FooBarWidget
Copy link
Member

The code looks good. You should include an integration test though, in test/integration/nginx_tests.rb under "various features".

@stepheneb
Copy link
Contributor Author

It looks like I'll need to modify or create some new resources in the test/stubs/ folder in order to test tis behavior.

I noticed this behavior while serving up a rails app with nginx in stand-alone mode with an index.html in a subdirectory under /public.

Do you have any more suggest for the best way/place to implement this behavior test?

@stepheneb
Copy link
Contributor Author

perhaps it would be enough to create:

tests/stubs/nginx/dir/index.html

and add a test in n test/integration/nginx_tests.rb under "various features" that makes sure index.html is returned when a request is made to '/dir' and to '/dir/'

@FooBarWidget
Copy link
Member

In the integration tests we reserve a number of virtual hosts for testing purposes (1.passenger.test ... 6.passenger.test). You can use one of them if you need custom Nginx settings. Furthermore the stub app directory is recreated on every test so it's okay to put files in "#{@some_app_stub.app_dir}/public", they'll be removed after the test.

@OnixGH
Copy link
Contributor

OnixGH commented Apr 7, 2015

Hi @stepheneb, there are two reasons we couldn't merge your code: we needed an accompanying test, as well as a signed contributor agreement.

I just took care of writing the test (in this commit), could you sign the agreement? Thanks!

@stepheneb
Copy link
Contributor Author

agreement signed

@OnixGH
Copy link
Contributor

OnixGH commented Apr 7, 2015

Yep, we got it, thanks! It's merge deconflicted into https://github.com/phusion/passenger/commits/PR_15 and awaiting final merge :)

@OnixGH
Copy link
Contributor

OnixGH commented Apr 8, 2015

Merged to 5.0.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants