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

seahub behind apache with mod_proxy_fcgi does not work #884

Closed
liayn opened this Issue Oct 9, 2014 · 9 comments

Comments

Projects
None yet
5 participants
@liayn

liayn commented Oct 9, 2014

Hi!

I tried to set up seahub behind apache 2.4 with mod_proxy_fcgi instead of mod_fastcgi.

The only difference should be that the apache config does not need the FastCGIExternalServer line and the rewrite rule should look like this:

RewriteRule ^(.*)$ fcgi://127.0.0.1:8000$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization},P]

Notice the P as the last flag.

Obviously apache hands the request to seahub (http://example.com/), as seahub issues a Location header for a redirect to http://example.com/accounts/login. (Notice the missing ending slash, which is present when doing it with mod_fastcgi)
The browser's request to http://example.com/accounts/login triggers the same redirect in an endless loop (until the browser stops with an redirection error).

Does anybody have a hint for me, what the correct configuration is, such that I can use mod_proxy_fcgi?

I'm not a python/django programmer, so I've no clue how/where to debug the thing, to find out the subtle difference between these fcgi approaches.

Thanks for your help.

@smarsching

This comment has been minimized.

Show comment
Hide comment
@smarsching

smarsching Nov 16, 2014

For Seafile 4.0.0, I made it work with the following configuration:

# Seafile static files
Alias /media /home/seafile/haiwen/seafile-server-latest/seahub/media
<Location /media>
  ProxyPass !
  Require all granted
</Location>

# Seafile file server
ProxyPass /seafhttp http://localhost:8082
ProxyPassReverse /seafhttp http://localhost:8082

# Seafile WebDAV server
ProxyPass /seafdav http://localhost:8080/seafdav
ProxyPassReverse /seafdav http://localhost:8080/seafdav

# Seafile seahub server
SetEnvIf Request_URI . proxy-fcgi-pathinfo=1
ProxyPass / fcgi://localhost:8000/

As you can see, there are no rewrite rules at all. The key is setting the proxy-fcgi-pathinfo environment variable. This will make mod_proxy_fcgi pass the path info to the FCGI script (by default it will not). Unfortunately, I could not make the seafdav service work via FCGI (I am getting a Python TypeError exception). I am not sure whether this is a general bug in the 4.0.0 beta release or it is a problem with mod_proxy_fcgi vs. mod_fastcgi. Anyway, it works fine when running in HTTP mode.

smarsching commented Nov 16, 2014

For Seafile 4.0.0, I made it work with the following configuration:

# Seafile static files
Alias /media /home/seafile/haiwen/seafile-server-latest/seahub/media
<Location /media>
  ProxyPass !
  Require all granted
</Location>

# Seafile file server
ProxyPass /seafhttp http://localhost:8082
ProxyPassReverse /seafhttp http://localhost:8082

# Seafile WebDAV server
ProxyPass /seafdav http://localhost:8080/seafdav
ProxyPassReverse /seafdav http://localhost:8080/seafdav

# Seafile seahub server
SetEnvIf Request_URI . proxy-fcgi-pathinfo=1
ProxyPass / fcgi://localhost:8000/

As you can see, there are no rewrite rules at all. The key is setting the proxy-fcgi-pathinfo environment variable. This will make mod_proxy_fcgi pass the path info to the FCGI script (by default it will not). Unfortunately, I could not make the seafdav service work via FCGI (I am getting a Python TypeError exception). I am not sure whether this is a general bug in the 4.0.0 beta release or it is a problem with mod_proxy_fcgi vs. mod_fastcgi. Anyway, it works fine when running in HTTP mode.

@smarsching

This comment has been minimized.

Show comment
Hide comment
@smarsching

smarsching Nov 17, 2014

I just found out that for the web-services API to work, an additional line seems to be needed, so that the HTTP Authorization header is made available:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

smarsching commented Nov 17, 2014

I just found out that for the web-services API to work, an additional line seems to be needed, so that the HTTP Authorization header is made available:

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
@tomchiverton

This comment has been minimized.

Show comment
Hide comment
@tomchiverton

tomchiverton Mar 22, 2015

This needs to go in the main docs. mod_fastcgi isn't available for Apache 2.4 in Fedora, for instance, and this method is much more straight forward.

tomchiverton commented Mar 22, 2015

This needs to go in the main docs. mod_fastcgi isn't available for Apache 2.4 in Fedora, for instance, and this method is much more straight forward.

@liayn

This comment has been minimized.

Show comment
Hide comment
@liayn

liayn Mar 23, 2015

I can confirm that this approach works like a charm now. Add it to the docs!

liayn commented Mar 23, 2015

I can confirm that this approach works like a charm now. Add it to the docs!

@liayn liayn closed this Mar 23, 2015

@freeplant freeplant added the type-idea label Mar 23, 2015

@tomchiverton

This comment has been minimized.

Show comment
Hide comment
@tomchiverton

tomchiverton Mar 23, 2015

Are the docs editable ?

tomchiverton commented Mar 23, 2015

Are the docs editable ?

@freeplant

This comment has been minimized.

Show comment
Hide comment
@freeplant
Member

freeplant commented Mar 23, 2015

tomchiverton added a commit to tomchiverton/seafile-docs that referenced this issue Mar 23, 2015

Update Apache deploy notes to skip mod_fastcgi under Apache 2.4
As per haiwen/seafile#884 there's no need to use the incresingly problematic mod_fastcgi. Apache 2.4 can be connected purely using mod_proxy
@zangetsu05

This comment has been minimized.

Show comment
Hide comment
@zangetsu05

zangetsu05 Apr 19, 2015

Hi all, i have a problem to deploy seafile under Apache/mod_proxy_fcgi.
Your example work fine if you deploy seafile as the root domain, es: https://www.somesite.com/
but it doesn't work if you want to deploy it as a non-root domain.
Most of the errors are like page not find or work uri in response, so i think that the key is
the ProxyPass related to the fcgi module.
Can you help me to set the right configuration to work with this kind of url: https://www.somesite.com/seafile ?

zangetsu05 commented Apr 19, 2015

Hi all, i have a problem to deploy seafile under Apache/mod_proxy_fcgi.
Your example work fine if you deploy seafile as the root domain, es: https://www.somesite.com/
but it doesn't work if you want to deploy it as a non-root domain.
Most of the errors are like page not find or work uri in response, so i think that the key is
the ProxyPass related to the fcgi module.
Can you help me to set the right configuration to work with this kind of url: https://www.somesite.com/seafile ?

@tomchiverton

This comment has been minimized.

Show comment
Hide comment
@tomchiverton

tomchiverton Apr 30, 2015

@zangetsu05 are you saying you want to use a simple ProxyPass based method with a non-domain root Seafle install ? Adjust the Alias, Location and left hand side of the ProxyPass to match. Probably.

tomchiverton commented Apr 30, 2015

@zangetsu05 are you saying you want to use a simple ProxyPass based method with a non-domain root Seafle install ? Adjust the Alias, Location and left hand side of the ProxyPass to match. Probably.

@zangetsu05

This comment has been minimized.

Show comment
Hide comment
@zangetsu05

zangetsu05 Apr 30, 2015

Resolved in #1186 thanks!

zangetsu05 commented Apr 30, 2015

Resolved in #1186 thanks!

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