Closed (fixed)
Project:
FileField Nginx Progress
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Oct 2010 at 11:37 UTC
Updated:
16 Oct 2010 at 10:30 UTC
Version 1.1 introduced this code to read a base url:
+ // Find root url of server
+ if (isset($_SERVER['SERVER_NAME'])) {
+ $domain = $_SERVER['SERVER_NAME'];
+ if ($_SERVER['SERVER_PORT'] != 80) {
+ $domain .= ':' . $_SERVER['SERVER_PORT'];
+ }
+ }
+ elseif (isset($_SERVER['HTTP_HOST'])) {
+ $domain = $_SERVER['HTTP_HOST'];
+ }
+ $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://';
+ $base_url = $proto . $domain;
+
+ $url = url($base_url . '/progress', array('query' => 'X-Progress-ID=' . $key, 'absolute' => TRUE, 'external' => TRUE));
+
but in my configurations with multiple domains using the same configuration file, the SERVER_NAME does not match the HTTP_HOST.
My server config is something like this:
server {
listen 69.xx.xx.xx:80;
listen 69.xx.xx.yy:80;
server_name
_drupal-boost
www.example1.com
www.example2.com
www.example3.com
;
root /var/www/$host/public;
access_log /var/log/nginx/$host.access.log;
...
By default, nginx uses the first domain as the SERVER_NAME, so I put in a bogus name first so that requests to www.example3.com don't get SERVER_NAME=www.example1.com. Either way, it messes with the module unless there's only one domain defined.
Is there an advantage to use SERVER_NAME instead of HTTP_HOST?
Comments
Comment #1
smoothify commentedHi Brian,
This code was added as a result of #876564: problem with drupal in sub dir, to fix issues of running drupal in a subdirectory.
It looks like I just overlooked this problem to get the subdir issue working, I'm not sure why I picked SERVER_NAME instead of HTTP_HOST really.
I will change this asap, am I right in thinking that I will still need to determine the SERVER_PORT for it to work in all cases using HTTP_HOST, or does the HTTP_HOST provide that information?
Comment #2
brianmercer commentedFor me HTTP_HOST includes the port. I tested:
on a random port and it worked fine. I'll test a subdirectory install later today and post the results.
Thanks much.
Comment #3
smoothify commentedThanks for testing that for me Brian
I believe the subdirectory install should still work with that code, but i'll wait for your feedback before committing anything.
Comment #4
brianmercer commentedI tested with a subdirectory install and odd port and it works great. Thanks.
Comment #5
smoothify commentedTested and works for me too - Thanks.
Committed now, and new 1.2 release made.
Comment #6
smoothify commentedchanging status.