Share cookies between subdomain and domain

If you set a cookie like this: Set-Cookie: name=value then the cookie will only apply to the request domain, and will only be sent for requests to the exact same domain, not any other subdomains. (See What is a host only cookie?) Two different domains (e.g. example.com and subdomain.example.com, or sub1.example.com and sub2.example.com) can only … Read more

What are the allowed characters in a subdomain?

Letters (except stressed à), Numbers 0-9 and Hyphen. http://en.wikipedia.org/wiki/Domain_name excerpt: Valid characters that can be used in a domain name are: a-z 0-9 – but not as a starting or ending character . as a separator for the textual portions of a domain name From https://www.rfc-editor.org/rfc/rfc1035 Various objects and parameters in the DNS have size … Read more

SSL Multilevel Subdomain Wildcard

No, it is not possible. A wildcard inside a name only reflects a single label and the wildcard can only be leftmost. Thus *.*.example.org or www.*.example.org are not possible. And *.example.org will neither match example.org nor www.subdomain.example.org, only subdomain.example.org. But you can have multiple wildcard names inside the same certificate, that is you can have … Read more

PHP Getting Domain Name From Subdomain

Stackoverflow Question Archive: How to get domain name from url? Check if domain equals value? How do I get the base url? print get_domain(“http://somedomain.co.uk”); // outputs ‘somedomain.co.uk’ function get_domain($url) { $pieces = parse_url($url); $domain = isset($pieces[‘host’]) ? $pieces[‘host’] : ”; if (preg_match(‘/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i’, $domain, $regs)) { return $regs[‘domain’]; } return false; }

Rails routing to handle multiple domains on single application

It’s actually simpler in Rails 3, as per http://guides.rubyonrails.org/routing.html#advanced-constraints: 1) define a custom constraint class in lib/domain_constraint.rb: class DomainConstraint def initialize(domain) @domains = [domain].flatten end def matches?(request) @domains.include? request.domain end end 2) use the class in your routes with the new block syntax constraints DomainConstraint.new(‘mydomain.com’) do root :to => ‘mydomain#index’ end root :to => ‘main#index’ … Read more

HTML5 localStorage size limit for subdomains

From http://dev.w3.org/html5/webstorage/#disk-space A mostly arbitrary limit of five megabytes per origin is recommended. Implementation feedback is welcome and will be used to update this suggestion in the future. It also mentions that : User agents should guard against sites storing data under the origins other affiliated sites, e.g. storing up to the limit in a1.example.com, … Read more

Virtualhost For Wildcard Subdomain and Static Subdomain

<VirtualHost *:80> DocumentRoot /var/www/app1 ServerName app1.example.com </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/example ServerName example.com </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/wildcard ServerName other.example.com ServerAlias *.example.com </VirtualHost> Should work. The first entry will become the default if you don’t get an explicit match. So if you had app.otherexample.com point to it, it would be caught be app1.example.com.

How can I configure multiple sub domains in Express.js or Connect.js

Or alternatively you could use vhost. Then, create several sites in their own directory and export the express app, eg. /path/to/m/index.js: var app = express() /* whatever configuration code */ exports.app = app // There is no need for .listen() And then handle all requests with the following app: var vhost = require(‘vhost’); express() .use(vhost(‘m.mysite.com’, … Read more