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

index files not working #46

Closed
jarischaefer opened this issue Jul 31, 2016 · 10 comments
Closed

index files not working #46

jarischaefer opened this issue Jul 31, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@jarischaefer
Copy link

jarischaefer commented Jul 31, 2016

The index file seems to be ignored with nginx 1.11.2 if fancyindex is enabled. If I recall correctly, the module used to work like a drop-in replacement for autoindex and respected the index files.

@jarischaefer jarischaefer changed the title autoindex not working index files not working Jul 31, 2016
@cjmayo
Copy link

cjmayo commented Aug 4, 2016

For me I think this was still OK in 1.9.15 and not working in 1.10.1.

@aperezdc
Copy link
Owner

aperezdc commented Aug 4, 2016

It seems that I will need to find out in which version of Nginx things stopped working. One question: are you using fancyindex as a loadable dynamic module, or built into Nginx statically?

@jarischaefer
Copy link
Author

Statically

@cjmayo
Copy link

cjmayo commented Aug 5, 2016

Statically also. I've checked, 1.9.15 was OK.

1.9.15 was with Fancy Index 0.3.6
1.10.1 and 1.11.2 with Fancy Index 0.4.0

@tdavis
Copy link

tdavis commented Aug 8, 2016

Was about to report this. FI 0.4.0 (static) with 1.10.1 ignores index.html here, as well.

@aperezdc
Copy link
Owner

aperezdc commented Aug 9, 2016

Thanks for all the comments. I'll check the changes introduced by Nginx and try to fix this issue as soon as I'm back from holidays later this week. Sorry for keeping you waiting!

@aperezdc aperezdc added this to the v0.4.1 milestone Aug 18, 2016
@aperezdc
Copy link
Owner

I have just started adding a test suite for the module (see #47), and I am now going to add a couple of test cases which reproduce this issue. It was about time to have tests 😉

@aperezdc
Copy link
Owner

aperezdc commented Aug 18, 2016

Okay, I have an explanation for this: in versions after 1.9.11 (which introduced dynamic module support) the following piece of the config file is not ran:

# XXX: Insert fancyindex module *after* index module!
#
HTTP_MODULES=`echo "${HTTP_MODULES}" | sed -e \
  's/ngx_http_index_module/ngx_http_fancyindex_module ngx_http_index_module/'`

That is because after 1.9.11 the new system for configuring modules is used. For dynamic builds I have been already able to fix the issue by setting:

ngx_module_order="$ngx_module_name
                  ngx_http_autoindex_module"

That causes the correct module order to be used when loading the module dynamically. Unfortunately for static builds the $ngx_module_order variable is ignored, and reordering $HTTP_MODULES in the way it was done before 1.9.11 does not work either. I am going through the files in auto/* in the Nginx source code to find out if some workaround could be used.

@aperezdc
Copy link
Owner

It seems that using the old-style config snippet works even in recent Nginx releases when building the module statically. The following works in all supported versions:

if [ $ngx_module_link = DYNAMIC ] ; then
   # Define $ngx_module_order and source auto/module
else
   # Manually edit $HTTP_MODULES and $NGX_ADDON_SRCS
fi

Soon I will be pushing a fix for this issue 😄

aperezdc added a commit that referenced this issue Aug 18, 2016
For static builds we still need to manually reorder $HTTP_MODULES, and we
cannot source "auto/module" like the new-style configuration mode needs,
because the "auto/module" snippet modifies $HTTP_MODULES itself, but ignores
the new $ngx_module_order variable when doing a static build.

Fortunately, the old-style way of configuring the module is still working in
all Nginx versions for statically built modules, so we can keep using that
for static builds.

This fixes issue #46.
aperezdc added a commit that referenced this issue Aug 18, 2016
For static builds we still need to manually reorder $HTTP_MODULES, and we
cannot source "auto/module" like the new-style configuration mode needs,
because the "auto/module" snippet modifies $HTTP_MODULES itself, but ignores
the new $ngx_module_order variable when doing a static build.

Fortunately, the old-style way of configuring the module is still working in
all Nginx versions for statically built modules, so we can keep using that
for static builds.

This fixes issue #46.
@aperezdc
Copy link
Owner

The fix is now in master, and the new tests are passing in the CI. Closing.

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

No branches or pull requests

4 participants