This is done regularly. We have dozens of websites all running on the one IP address, and it's not uncommon to run hundreds. Your web server will inspect the hosts header of the request and serve appropriately.
There are two methods to implement this, and they're both the same, but for different web servers. You did not specify which one you used, so here's the three most common:
IIS 5/6
Right-click on your website and go to Properties. Next to "IP Address" (on the Web Site tab), click Advanced. You will see an entry in there for Port 80, with no Host Header Name. Delete this entry.
Click Add, and under TCP Port leave it at 80 (or 443 for SSL), and under Host Header Name enter the name of the website (for example, mediaserver.mysite.com - although example.com is a reserved name exactly for this purpose but never mind). Click OK, and OK to the next screen And you're done. You can now access that website through mediaserver.mysite.com (and only through that, it won't listen on the IP alone any more).
IIS 7
Same as IIS 5/6 except instead of right-clicking the website, you just select it and on the right-hand side menu choose "Bindings"
Apache
I don't configure apache very often, so my memory is very fuzzy, but you use the name-based VirtualHost directive in your httpd.conf. From the apache example documentation:
NameVirtualHost *
<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>
(I recommend reading the rest of that documentation page if you are using Apache).
Ok, so once again we come down to user error. At some point the problem changed because I changed some of the code above, so that
def post_authentication_api(request):
became
def post_authentication_api(self, request):
this doesnt work because as Graham said at the django mailing list
"If you ... have a 'self' first argument for a function which
isn't a method of a class, it is obvious you are going to get:"
Exception Type: TypeError at /auth/post_authentication_api
Exception Value: post_authentication_api() takes exactly 2 arguments
(1 given)
So after I fixed that up I came to the root of the problem (as far as I can tell) which was that wsgi was blocking sys.stdout. which I think seems fair to me, and I had some print statements in my code and this is why it wasnt running. A very simple problem that for some reason became very complicated.
Anyway, Great thanks to Graham who has helped me out for the last week on this. He has been tireless and very accommodating to someone who is quite embarrassed about the final outcome. Some votes will be coming his way for the comments and my many thanks as well.
Thanks again
Mark
Best Answer
I believe you should be able to do this with Apache's LimitRequestBody method.