subdomain

Nginx convert subdomain to path component without redirect

别说谁变了你拦得住时间么 提交于 2019-12-17 17:34:16
问题 The idea is to take incoming requests to http://abc.example.com/... and rewrite them to http://example.com/abc/... That's easy enough to do with a 301/302 redirect: # rewrite via 301 Moved Permanently server { listen 80; server_name abc.example.com; rewrite ^ $scheme://example.com/abc$request_uri permanent; } The trick is to do this URL change transparently to the client when abc.example.com and example.com point at the same Nginx instance. Put differently, can Nginx serve the contents from

CakePHP website mobile version

大城市里の小女人 提交于 2019-12-17 17:26:59
问题 I have developed a full website with CakePHP framework and we'd like to make a very light version of the website for mobile devices (mainly iPhone/iPad). Is there a way to use the existing website with a new sub domain (for instance mobile.mywebsite.com) which will render specific views? I would like to avoid copying and simplifying the current one to match the new one requirements. I do not want to have to "re-develop" a new CakePHP website and do the changes twice every time I need to

Domain name for my PC: how to (tried No-IP, DuckDNS and ngrok)

梦想的初衷 提交于 2019-12-17 16:54:31
问题 I want: ping server on my PC by it domain name from remote. I have: DynDNS services DuckDns (or No-IP, config in no-ip is even harder). It gets me an IP 94.154.220.216 and (sub)domain http://my_domain.duckdns.org . To configure DuckDNS on PC I need just specify some token and my domain name ( my_domain ). Also I've launched server on lacalhost:3000 . Also when I go to CanYouSeeMee it says that my IP is 94.154.220.216 (that's good). And I configured static IP for my PC (let's say 200.300.1.15

How exactly is the same-domain policy enforced?

末鹿安然 提交于 2019-12-17 16:34:01
问题 Let's say I have a domain, js.mydomain.com , and it points to some IP address, and some other domain, requests.mydomain.com , which points to a different IP address. Can a .js file downloaded from js.mydomain.com make Ajax requests to requests.mydomain.com ? How exactly do modern browsers enforce the same-domain policy? 回答1: The short answer to your question is no: for AJAX calls, you can only access the same hostname (and port / scheme) as your page was loaded from. There are a couple of

ASP.NET MVC Routing based on domain & hostname

本秂侑毒 提交于 2019-12-17 16:28:39
问题 I am new to ASP.NET MVC, most of my experience is on ASP.NET Webforms. Is there a way to setup routing based on domain/hostname, i.e. www.domain.com goes to one area, admin.domain.com to another and www.differentdomain.com to yet another area all on the web application. Also, is there a way to do a catch-all i.e. *.domain.com will be routed to another area? 回答1: you can use Domain Routing mapping routes.Add("DomainRoute", new DomainRoute( "{customer}.example.com", // Domain with parameters "

Regular Expression - Extract subdomain & domain [duplicate]

北城以北 提交于 2019-12-17 15:42:29
问题 This question already has answers here : How do I parse a URL into hostname and path in javascript? (20 answers) Closed 2 years ago . I'm trying to form a regular expression (javascript/node.js) which will extract the sub-domain & domain part from any given URL. This is what I ended up with: [^(?:http:\/\/|www\.|https:\/\/)]([^\/]+) Right now, I'm just considering http, https for protocol & exclude "www." portion from the subdomain+domain portion of an URL. I checked the expression & it

Best way for allowing subdomain session cookies using Tomcat

有些话、适合烂在心里 提交于 2019-12-17 15:30:00
问题 By default tomcat will create a session cookie for the current domain. If you are on www.example.com, your cookie will be created for www.example.com (will only work on www.example.com). Whereas for example.com it will be created for .example.com (desired behaviour, will work on any subdomain of example.com as well as example.com itself). I've seen a few Tomcat valves which seem to intercept the creation of session cookies and create a replacement cookie with the correct .example.com domain,

MVC 3 Subdomain Routing [duplicate]

一笑奈何 提交于 2019-12-17 15:17:24
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Is it possible to make an ASP.NET MVC route based on a subdomain? In asp.net MVC 3 site i'd like to create online stores for users. Any store that is created by user should have a URL like " shopname .mydomain.com" . I tried some routing work but failed at all. I am researching for a solution but cannot find any proper solution. My purpose is that; if I can add a route to manage any request that tries to find a

Cross sub domain iframes and JavaScript

杀马特。学长 韩版系。学妹 提交于 2019-12-17 10:41:32
问题 I am working on a CMS site whose domain is: http://www.acmssite.com They have a sub-domain where they store a form system: http://www.forms.acmssite.com I have an iframe on the first that looks at a form in the latter. I need to run scripts to manipulate the latter from the former and was wondering is this possible? 回答1: In order for this to not be restricted by the same origin policy, you will probably need to do this in both the pages: document.domain = "acmssite.com"; 回答2: Yes it is. var

Rails rspec set subdomain

流过昼夜 提交于 2019-12-17 08:55:16
问题 I am using rSpec for testing my application. In my application controller I have a method like so: def set_current_account @current_account ||= Account.find_by_subdomain(request.subdomains.first) end Is it possible to set the request.subdomain in my spec? Maybe in the before block? I am new to rSpec so any advice on this would be great thanks. Eef 回答1: I figured out how to sort this issue. In my before block in my specs I simply added: before(:each) do @request.host = "#{mock_subdomain}