使用CloudFormation的API网关自定义域

时间:2018-01-11 00:35:43

标签: aws-api-gateway amazon-cloudformation

我正在尝试使用CloudFormation为API网关定义自定义域(实际上是子域)。根据所有文档我已经能够找到以下应该可以工作但是当我部署它时,Invalid domain name identifier specified

获得BasePathMapping
aws cloudformation deploy --template-file packaged-prompt.yaml --capabilities CAPABILITY_IAM --stack-name prompt-stack

prompt.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:

  ...

  Certificate:
    Type: 'AWS::CertificateManager::Certificate'
    Properties:
      DomainName: example.mydomain.com

  DomainName:
    Type: 'AWS::ApiGateway::DomainName'
    Properties:
      CertificateArn: !Ref Certificate
      DomainName: example.mydomain.com

  Mapping:
    Type: 'AWS::ApiGateway::BasePathMapping'
    Properties:
      DomainName: !Ref DomainName
      RestApiId: !Ref Api

  Api:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      DefinitionBody:
        swagger: 2.0
        info:
          title:
            Ref: AWS::StackName
        paths:

          ....

1 个答案:

答案 0 :(得分:0)

BasePathMapping中的属性丢失

var url = "http://kissasian.sh/Drama/My-Mister/Episode-1?id=36170";
var msg = "ui0uI3/FNJEDeMXFKFzBVr30Yc6w34jKMp2NWjnnv355ptM/1h5bostMEAZVqsyi";
var rootUrl = "http://kissasian.sh/Scripts/";
var jsS = [
  "common.js?v=3",
  'jquery.allofthelights-min.js?v=3',  // this was missing from your original code
  "aes.js",
  "sha256.min.js",
  "subo.min.js?v=3.19"
];
console.log('Loading scripts ...');
(async () => {
  const resp = await fetch(url);
  const text = await resp.text();
  const doc = new DOMParser().parseFromString(text, 'text/html');
  // Get all inline script tags
  const [first, ...inlineScripts] = doc.querySelectorAll('script:not([src])');
  // we'll eval the inlineScripts later, after the subo script runs (defines $kissenc)
  // but the first must be evaled before subo runs
  eval(first.textContent);

  // load the 5 external scripts
  for (let i = 0; i < jsS.length; i++) {
    const resp = await fetch(rootUrl + jsS[i]);
    const text = await resp.text();
    eval(text);
  }

  // window.$kissenc is now defined,
  // now we can iterate through the inlineScripts that look obfuscated and eval them:
  let textToDecode;
  for (const { textContent } of inlineScripts) {
    if (textContent.includes('decrypt')) {
      // we've gotten to the script that decrypts;
      // don't run it, instead call decrypt ourselves,
      // and break out of the loop:
      const match = textContent.match(/decrypt\('([^']+).+/);
      textToDecode = match[1];
      break;
    } else if (textContent.includes('\\x') || /^\s+_/.test(textContent)) {
      eval(textContent);
    }
  }
  console.log('Decrpyting ', textToDecode);
  var decrypted = $kissenc.decrypt(textToDecode);
  console.log(decrypted);
})();