kopia lustrzana https://github.com/c9/core
Merge pull request +9895 from c9/fix-profile-base-url
Fix profile base urlpull/223/head
commit
6960ab7b0e
|
@ -25,9 +25,27 @@ function main(options, imports, register) {
|
||||||
/**
|
/**
|
||||||
* Get a desired base URL, given some context.
|
* Get a desired base URL, given some context.
|
||||||
*
|
*
|
||||||
* @param req The current request object or URL
|
* Example for a request coming into the IDE service:
|
||||||
* @param {String} [sourceUrlPattern] The source URL pattern, e.g. https://ide.$DOMAIN
|
*
|
||||||
* @param {String} targetBaseUrlPattern The target URL pattern, e.g. https://$DOMAIN
|
* ```
|
||||||
|
* getBaseUrl(req, "https://ide.$DOMAIN", "https://preview.$DOMAIN");
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The above example will determine the domain name from the request,
|
||||||
|
* by stripping off the "https://ide." part. So, for a domain like
|
||||||
|
* "https://ide.c9.io" we'll get "c9.io". For a domain like
|
||||||
|
* "https://ide.dogfooding-lennartcl.c9.io" we'll get dogfooding-lennartcl.c9.io.
|
||||||
|
* If there is no match, a warning is shown. The target pattern
|
||||||
|
* is used to construct the resulting URL, e.g. https://preview.c9.io.
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* The current request object or URL
|
||||||
|
* @param {String} [sourceUrlPattern]
|
||||||
|
* The URL pattern of the current service, e.g. https://ide.$DOMAIN if
|
||||||
|
* we are getting an incoming request for the IDE service
|
||||||
|
* @param {String} targetBaseUrlPattern
|
||||||
|
* The URL pattern of the target service. E.g., if we want to
|
||||||
|
* construct the base URL of the API service, this might be https://api.$DOMAIN.
|
||||||
*/
|
*/
|
||||||
plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
|
plugin.getBaseUrl = function(req, sourceBaseUrlPattern, targetBaseUrlPattern) {
|
||||||
var sourceHost = req.headers && req.headers.host
|
var sourceHost = req.headers && req.headers.host
|
||||||
|
|
Ładowanie…
Reference in New Issue