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

Apache mod_mime's default httpd/x-unix-directory Content-Type should be unset #1197

Closed
kiranos opened this Issue May 29, 2014 · 15 comments

Comments

Projects
None yet
2 participants
@kiranos

kiranos commented May 29, 2014

There is something in passenger that make this app not work, it lets you download the html code instead of showing it. Might be because of compatibility issues with passenger.

Also "passenger start" works from the dir

@FooBarWidget FooBarWidget changed the title from [Node.js] https://github.com/Stackato-Apps/node-env doesnt work (node server.js works) to https://github.com/Stackato-Apps/node-env doesnt work (node server.js works) May 29, 2014

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget May 29, 2014

Member

This is apparently the same issue as #1196.

Member

FooBarWidget commented May 29, 2014

This is apparently the same issue as #1196.

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos May 29, 2014

Hm its not the same issue, I tried using the default way:

 cat app.js
require('./server.js');

And not setting any special settings in apache2, just default for node.js and it doesnt work for me. And "passenger start" works. (but not through apache2)

kiranos commented May 29, 2014

Hm its not the same issue, I tried using the default way:

 cat app.js
require('./server.js');

And not setting any special settings in apache2, just default for node.js and it doesnt work for me. And "passenger start" works. (but not through apache2)

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget May 29, 2014

Member

What happens if you set PassengerAppRoot does that still not work? How does your configuration look like now?

Member

FooBarWidget commented May 29, 2014

What happens if you set PassengerAppRoot does that still not work? How does your configuration look like now?

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos May 29, 2014

Now it looks like default:

 cat /etc/apache2/sites-enabled/000-default
<VirtualHost *:80>

  ServerName www.yourhost.com
  DocumentRoot /home/node/node-env/public
  <Directory /home/node/node-env/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
  </Directory>

 CustomLog /home/node/logs/node-env-access_log combined
 PassengerDebugLogFile /home/node/logs/node-env-error_log

</VirtualHost>

dir:

ls - l /home/node/node-env/
-rw-r--r-- 1 node node   24 May 29 20:06 app.js
-rw-r--r-- 1 node node  238 May 29 20:02 humans.txt
drwxr-xr-x 3 node node 4096 May 29 20:02 images
-rw-r--r-- 1 node node 5494 May 29 20:02 index.html
drwxr-xr-x 2 node node 4096 May 29 20:02 javascripts
drwxr-xr-x 2 node node 4096 May 29 20:02 lib
drwxr-xr-x 2 node node 4096 May 29 20:39 log
-rw-r--r-- 1 node node  131 May 29 20:02 package.json
-rw-r--r-- 1 node node   20 May 29 20:02 Procfile
drwxr-xr-x 2 node node 4096 May 29 20:43 public
-rw-r--r-- 1 node node  168 May 29 20:02 README.md
-rw-r--r-- 1 node node  106 May 29 20:02 robots.txt
-rw-r--r-- 1 node node 2020 May 29 20:02 server.js
-rw-r--r-- 1 node node   26 May 29 20:02 stackato.yml
drwxr-xr-x 2 node node 4096 May 29 20:03 static
drwxr-xr-x 2 node node 4096 May 29 20:02 stylesheets
drwxr-xr-x 3 node node 4096 May 29 20:33 tmp

cat app.js
require('./server.js');

So this has nothing to do with my issue with custom start file etc. which work now when I set the PassengerAppRoot, thanks! :)

kiranos commented May 29, 2014

Now it looks like default:

 cat /etc/apache2/sites-enabled/000-default
<VirtualHost *:80>

  ServerName www.yourhost.com
  DocumentRoot /home/node/node-env/public
  <Directory /home/node/node-env/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
  </Directory>

 CustomLog /home/node/logs/node-env-access_log combined
 PassengerDebugLogFile /home/node/logs/node-env-error_log

</VirtualHost>

dir:

ls - l /home/node/node-env/
-rw-r--r-- 1 node node   24 May 29 20:06 app.js
-rw-r--r-- 1 node node  238 May 29 20:02 humans.txt
drwxr-xr-x 3 node node 4096 May 29 20:02 images
-rw-r--r-- 1 node node 5494 May 29 20:02 index.html
drwxr-xr-x 2 node node 4096 May 29 20:02 javascripts
drwxr-xr-x 2 node node 4096 May 29 20:02 lib
drwxr-xr-x 2 node node 4096 May 29 20:39 log
-rw-r--r-- 1 node node  131 May 29 20:02 package.json
-rw-r--r-- 1 node node   20 May 29 20:02 Procfile
drwxr-xr-x 2 node node 4096 May 29 20:43 public
-rw-r--r-- 1 node node  168 May 29 20:02 README.md
-rw-r--r-- 1 node node  106 May 29 20:02 robots.txt
-rw-r--r-- 1 node node 2020 May 29 20:02 server.js
-rw-r--r-- 1 node node   26 May 29 20:02 stackato.yml
drwxr-xr-x 2 node node 4096 May 29 20:03 static
drwxr-xr-x 2 node node 4096 May 29 20:02 stylesheets
drwxr-xr-x 3 node node 4096 May 29 20:33 tmp

cat app.js
require('./server.js');

So this has nothing to do with my issue with custom start file etc. which work now when I set the PassengerAppRoot, thanks! :)

@FooBarWidget FooBarWidget reopened this May 29, 2014

@FooBarWidget FooBarWidget added this to the 4.0.45 milestone May 29, 2014

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

I can't reproduce this problem using Apache, not even with 4.0.44. Maybe there's something else in your Apache configuration that's interfering. Can you post all your Apache config files?

Also, note that PassengerDebugLogFile is global, not per-vhost.

Member

FooBarWidget commented Jun 2, 2014

I can't reproduce this problem using Apache, not even with 4.0.44. Maybe there's something else in your Apache configuration that's interfering. Can you post all your Apache config files?

Also, note that PassengerDebugLogFile is global, not per-vhost.

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos Jun 2, 2014

Hi I recreated a new server and did the same thing again and get exactly the same result. I can email you root password and ip if you like to look into the issue on the server itself. But cant pm here so will send you an email to your buisness email.

kiranos commented Jun 2, 2014

Hi I recreated a new server and did the same thing again and get exactly the same result. I can email you root password and ip if you like to look into the issue on the server itself. But cant pm here so will send you an email to your buisness email.

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

Sure, please send to hongli@phusion.nl. Please note that giving me access to the server is at own risk, so please ensure that there's nothing sensitive on that server.

Member

FooBarWidget commented Jun 2, 2014

Sure, please send to hongli@phusion.nl. Please note that giving me access to the server is at own risk, so please ensure that there's nothing sensitive on that server.

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos Jun 2, 2014

sent the email, its a test vps you can remove what you like and redo. Edit configs etc is no problem, it will be destroyed once your done
Thanks

kiranos commented Jun 2, 2014

sent the email, its a test vps you can remove what you like and redo. Edit configs etc is no problem, it will be destroyed once your done
Thanks

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

I don't see an email. What's the subject?

Member

FooBarWidget commented Jun 2, 2014

I don't see an email. What's the subject?

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos Jun 2, 2014

Subject was "about the github issue you cant reproduce (user credetials to my test env)" and was sent out "Jun 2 15:36:39" 1h10min ago

maybe its in the spam folder?

kiranos commented Jun 2, 2014

Subject was "about the github issue you cant reproduce (user credetials to my test env)" and was sent out "Jun 2 15:36:39" 1h10min ago

maybe its in the spam folder?

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

I didn't receive it. Not in my spam either. Can you try honglilai@gmail.com?

Member

FooBarWidget commented Jun 2, 2014

I didn't receive it. Not in my spam either. Can you try honglilai@gmail.com?

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos Jun 2, 2014

sent again now:

Jun  2 16:58:22 postfix/smtp[7269]: E2DFA600755: to=<honglilai@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.71.27]:25, delay=0.79, delays=0.07/0/0.06/0.66, dsn=2.0.0, status=sent (250 2.0.0 OK 1401721154 x7si16581337lal.100 - gsmtp)

kiranos commented Jun 2, 2014

sent again now:

Jun  2 16:58:22 postfix/smtp[7269]: E2DFA600755: to=<honglilai@gmail.com>, relay=gmail-smtp-in.l.google.com[173.194.71.27]:25, delay=0.79, delays=0.07/0/0.06/0.66, dsn=2.0.0, status=sent (250 2.0.0 OK 1401721154 x7si16581337lal.100 - gsmtp)

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

I see the issue. Apache's mod_mime sets Content-Type to httpd/x-unix-directory whenever it notices that the current URL maps to a directory. Usually the web app overrides this Content-Type by providing its own Content-Type header, but node-env doesn't do that. The browser sees the httpd/x-unix-directory Content-Type and tries to download it.

You can work around this by disabling mod_mime. I'll modify 4.0.45 to unset the httpd/x-unix-directory header.

Member

FooBarWidget commented Jun 2, 2014

I see the issue. Apache's mod_mime sets Content-Type to httpd/x-unix-directory whenever it notices that the current URL maps to a directory. Usually the web app overrides this Content-Type by providing its own Content-Type header, but node-env doesn't do that. The browser sees the httpd/x-unix-directory Content-Type and tries to download it.

You can work around this by disabling mod_mime. I'll modify 4.0.45 to unset the httpd/x-unix-directory header.

@FooBarWidget FooBarWidget changed the title from https://github.com/Stackato-Apps/node-env doesnt work (node server.js works) to Apache mod_mime's default httpd/x-unix-directory Content-Type should be unset Jun 2, 2014

@kiranos

This comment has been minimized.

Show comment
Hide comment
@kiranos

kiranos Jun 2, 2014

nice thanks for looking into this!, can I remove the server later, are you done with it?

kiranos commented Jun 2, 2014

nice thanks for looking into this!, can I remove the server later, are you done with it?

@FooBarWidget

This comment has been minimized.

Show comment
Hide comment
@FooBarWidget

FooBarWidget Jun 2, 2014

Member

I'm done.

Member

FooBarWidget commented Jun 2, 2014

I'm done.

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