subdomain

Specifying a subdomain in the route definition in Express

旧城冷巷雨未停 提交于 2019-12-03 16:03:54
I'm new to ExpressJS and NodeJS in general, so I need directions on how to achieve this effect: app.get('/', 'sub1.domain.com', function(req, res) { res.send("this is sub1 response!"); }); app.get('/', 'sub2.domain.com', function(req, res) { res.send("this is sub2 response!"); } So that when I request sub1.domain.com the first handler reacts and on sub2.domain.com I get response from second handler. I've read some questions on SO about using vhost for this purpose, but I'd be more happy if what I described above worked rather than creating multiple server instances like in vhost. A quick and

Maintaining Session Variables across Subdomains

走远了吗. 提交于 2019-12-03 14:46:28
问题 I have been trying to maintain session vars between two subdomains and found it impossible. I ended up creating 2 minimal PHP web pages as a test bed, one I call 'test 1' just sets $_SESSION['test'] = "Fred"; and has a hyperlink to 'test 2' which simply tries to echo the value of $_SESSION['test'] to prove it's worked, or not. I place 'test 1' in my www domain and 'test 2' in my sub domain. I try various version of what should go in the header, from various sources. Here are the main 3 (and

How to create dynamic subdomains for each user using node express?

旧街凉风 提交于 2019-12-03 13:27:25
问题 On signup, I want to give user his profile and application at username.example.com I have already created wild-card dns at my domain provider website. How can I do that? 回答1: If using Node.js with Express.js, then: router.get('/', function (req, res) { var domain = req.get('host').match(/\w+/); // e.g., host: "subdomain.website.com" if (domain) var subdomain = domain[0]; // Use "subdomain" ... }); 回答2: // you can use this implementation to get subdomain dynamically // Use below code to get

Have Devise create a subdomain on registration

北城余情 提交于 2019-12-03 13:04:02
问题 I would like to have Devise create subdomains on my site. Right now, I have two models: Company: A Company can register directly on the site, and after signing in, can invite their employees. When the company registers, I want a unique subdomain to be created (e.g. example.com => techcraz.example.com.) Employee: An Employee can register only if they received an invitation link. What I would like: The main domain as a registration page. A single sign in page for both Companies and Employees .

Forms Authentication ReturnUrl and subdomain for single sign-on

早过忘川 提交于 2019-12-03 12:42:51
问题 I have a domain http://abc.com and a subdomain http://sub.abc.com . I'm implementing single sign-on between the two sites by sharing the forms authentication cookie. This is implemented by having both sites share the validationKey and decryptionKey in the machineKey. When the user hits a page in the subdomain I want the user authenticated in the root domain and redirected back to the subdomain. The user is redirected to the login page currently but the ReturnUrl wants to redirect to the root

How to create subdomains for IIS7 programmatically?

北战南征 提交于 2019-12-03 12:34:47
问题 I'm writing a SaaS app in C#/ASP.NET, hosted with IIS7. I want to create a personalized subdomain for every customer that signs up, i.e. fred.mydomain.com, bob.mydomain.com, each of which will point to the same app, just with a different skin per customer. How do I create these subdomains programmatically? 回答1: Use URL Rewrite for IIS7 to map all requests like user.mydomain.com (where user is not www, mail or other existing real subdomains) to mydomain.com/myapp?id=user Then in the script

How to redirect domain with prefix www in AWS Route 53

旧巷老猫 提交于 2019-12-03 11:13:05
I have a problem with domain hosting in Route 53. I need to redirect from xyz.com to www.xyz.com , so I created a Hosted Zone on Route 53. I added an A record with the address of my ELB, and a CNAME with a name of www.xyz.com and value of my ELB address. But this set up does not redirect my naked domain to my www prefixed domain. How do I solve this issue? I've gotten this to work using both S3 and CloudFront. You need two buckets: www.yourdomainname.com and yourdomainname.com . Keep your files in the www bucket. For the naked domain bucket properties, go to the "Static Website Hosting"

site 5x faster via mod_rewrite, but CSS images are broken

强颜欢笑 提交于 2019-12-03 10:16:39
问题 I am using .htaccess to accelerate a site with the following redirects: request for http://example.com/images/name.jpg routed to http://i.example.com/name.jpg request for http://example.com/css/name.css routed to http://c.example.com/name.css From listening to the Stack Overflow podcast, I learned that this could make a site faster, since the browser can download more files simultaneously (apparently two streams per domain, although this is unconfirmed). Indeed, the difference is dramatic;

How to create subdomain in Laravel dynamically?

假如想象 提交于 2019-12-03 09:36:37
问题 In my Windows/System32/drivers/etc/ hosts , I have this: 127.0.0.1 localhost 127.0.0.1 site.dev 127.0.0.1 *.site.dev In my xampp/apache/conf/extra/ httpd-vhost , I have this: <VirtualHost site.dev> DocumentRoot "C:/xampp_7/htdocs/" <Directory "C:/xampp_7/htdocs/"> </Directory> </VirtualHost> <VirtualHost *.site.dev> DocumentRoot "C:/xampp_7/htdocs/" <Directory "C:/xampp_7/htdocs/"> </Directory> </VirtualHost> Now if I am going to run http://site.dev/project/public, It is working. I have this

Django subdomain configuration for API endpoints

安稳与你 提交于 2019-12-03 08:51:32
I've set up a Django project which makes use of the django-rest-framework to provide some ReST functionality. The website and the rest functionality are all working fine. However there is one little problem: I need my API endpoints to point to a different subdomain . For example when a user visits the website he/she can navigate around normally according to my urls.py : http://example.com/control_panel So far so good. However when the API is used I want to change that to something more appropriate. So instead of http://example.com/api/tasks I need this to become: http://api.example.com/tasks