whobutdrew: (Rational)
Drew ([personal profile] whobutdrew) wrote in [site community profile] dw_dev2009-09-26 07:13 pm
Entry tags:

So close, and yet...

OK, so I got past my previous crisis. I now am back where I started: My site is live, I can create accounts, import content, etc. What I can't do is actually use the site as intended.

I am working off of the assumption that my ISP is blocking port 80 traffic. So my server is listening on port 9999, and my router has that port open and forwarding to my server. I can log in as any user, but if I try to go to that user's journal (http://user.my.domain.org:9999), it technically takes me there, as that's what the address bar tells me, but I get the main site's login page, not the journal. If I try to go to a user's profile (http://user.my.domain.org:9999/profile), then I get:

We can't find that page
If you typed the URL directly (or pasted it into your browser's address bar), make sure you didn't typo, paste too little, or paste too much. If you followed a link, report this to the maintainer of the page that linked you here.

According to the wiki, if I want subdomain support, I need to add a wildcard record to my DNS, which I've done (my 'domain' is simply a DynDNS.com host, and I have enabled wildcard support on it). I have also confirmed that the settings in etc/config.pl are set correctly:


$DOMAIN_WEB = "my.domain.org"
$SITE_ROOT "http://$DOMAIN_WEB:9999"

%SUBDOMAIN_FUNCTION = (
community => 'journal',
users => 'journal',
syndicated => 'journal',
cssproxy => 'cssproxy',
);

$USER_VHOSTS = 1;
$USER_DOMAIN = "$DOMAIN_WEB:9999"; (I have tried switching this between $DOMAIN and $DOMAIN_WEB to see if it would change anything. The quotes need to be there.)

$ONLY_USER_VHOSTS = 1;

In %CAP_DEF, 'userdomain' => 1 in both default and free, again, just to see what would happen (previously only in default).


What am I overlooking/missing?

I WILL find a way to give back to this community after asking for so much help. Promise!
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2009-09-27 12:34 pm (UTC)(link)
$USER_DOMAIN shouldn't have the port number in it - just use:

$USER_DOMAIN = $DOMAIN;

As far as I can tell, everything else is fine.

(and I'm so sorry I never managed to reply to your PM! :/ It sounds like you don't need EveryDNS now, but if you want I can still try to help you. You're actually better off reaching me via IM - my IM names are on my profile if you want.)

[edit: Actually, thinking about it... hmm. I must admit I've never actually used user subdomains while simultaneously using different port numbers. It might not actually be possible to do that as the code stands; the above will work for accessing them manually, but won't work for creating links to users. Will try to find out more.]

[edit 2: Yeah, looking at the code a bit, it appears that it isn't possible as it stands. That's probably a bug; I'll get it filed.

In the meantime, you can work around it by altering the code manually. In cgi-bin/LJ/User.pm, around line 7747 you'll see this:

   if ($vhost eq "users") {
        my $he_user = $user;
        $he_user =~ s/_/-/g;
        return "http://$he_user.$LJ::USER_DOMAIN";
    } elsif ($vhost eq "tilde") {

Change that fourth line to read:

        return "http://$he_user.$LJ::USER_DOMAIN:9999";

This will make linking work, but it'll probably break as soon as you update the code again, of course. Like I said, it's a bug so I'll get it filed - it shouldn't take too long to resolve it.]

(sorry for the editspam! Was fixing stuff. I'm done now. Honest.)
Edited 2009-09-27 12:48 (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2009-09-27 03:58 pm (UTC)(link)
[personal profile] sophie's comment triggered a memory, and got me looking into that area. To override the link that is created in, e.g., user tags, you can use the journal_base hook.

So, in a file, cgi-bin/DW/Hooks/JournalBase.pm, try this code:
package DW::Hooks::JournalBase;

use strict;

LJ::register_hook( 'journal_base', sub {
    my ( $u, $vhost ) = @_;
    if ( $vhost eq "users" ) {
        my $he_user = $u->user;
        $he_user =~ s/_/-/g;
        return "http://$he_user.$LJ::USER_DOMAIN:9999";
    }
} );

1;