-
Content-Type: application/json means a request can no longer be considered a CORS simple request, hence a CORS preflight request is triggered
-
https://auth0.com/blog/cors-tutorial-a-guide-to-cross-origin-resource-sharing/
-
seems that OPTIONS is not supported by AllowedMethods
-
however
-
"The rule also allows all headers in a preflight OPTIONS request through the Access-Control-Request-Headers header. In response to preflight OPTIONS requests, Amazon S3 returns requested headers"
-
this suggests that specifying Content-Type: application/json should be okay
-
it's undeniable that index.html/js seem to be able to retrieve index.json, even when deployed with Content-Type; you can see the Content-Type in the headers
-
./describe_stacks.sh
-
./deploy_stack.sh
-
./describe_outputs.sh
-
[copy URl into index.js]
-
[pull up index.html]
-
[is {"hello":"world"} printed to console ?]
-
./delete_stack.sh
-
./describe_stacks.sh
justin@justin-XPS-13-9360:~/work$ . ./setenv.sh
justin@justin-XPS-13-9360:~/work$ echo $AWS_DEFAULT_OUTPUT
table
justin@justin-XPS-13-9360:~/work$ ./describe_stacks.sh
--------------------------------------------------------------------------------
| DescribeStacks |
+-----------------------------------------------------------+------------------+
| 1.Name | 2.Status |
+-----------------------------------------------------------+------------------+
| #{an-existing-stack} | UPDATE_COMPLETE |
+-----------------------------------------------------------+------------------+
justin@justin-XPS-13-9360:~/work$ ./deploy_stack.sh
Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - jhw-hello-world
upload: ./index.html to s3://jhw-hello-world/index.html
justin@justin-XPS-13-9360:~/work$ ./describe_stacks.sh
--------------------------------------------------------------------------------
| DescribeStacks |
+-----------------------------------------------------------+------------------+
| 1.Name | 2.Status |
+-----------------------------------------------------------+------------------+
| #{an-existing-stack} | UPDATE_COMPLETE |
| jhw-hello-world | CREATE_COMPLETE |
+-----------------------------------------------------------+------------------+
justin@justin-XPS-13-9360:~/work$ ./describe_events.sh
------------------------------------------------------------------------------------------------------------------------------------
| DescribeStackEvents |
+--------------------------+------------------+-----------------------------+----------------------+-------------------------------+
| 1.Timestamp | 2.Id | 3.Type | 4.Status | 5.Reason |
+--------------------------+------------------+-----------------------------+----------------------+-------------------------------+
| 2019-10-25T09:36:57.545Z| jhw-hello-world | AWS::CloudFormation::Stack | CREATE_COMPLETE | None |
| 2019-10-25T09:36:56.388Z| AppBucketPolicy | AWS::S3::BucketPolicy | CREATE_COMPLETE | None |
| 2019-10-25T09:36:55.832Z| AppBucketPolicy | AWS::S3::BucketPolicy | CREATE_IN_PROGRESS | Resource creation Initiated |
| 2019-10-25T09:36:54.565Z| AppBucketPolicy | AWS::S3::BucketPolicy | CREATE_IN_PROGRESS | None |
| 2019-10-25T09:36:52.867Z| AppBucket | AWS::S3::Bucket | CREATE_COMPLETE | None |
| 2019-10-25T09:36:32.174Z| AppBucket | AWS::S3::Bucket | CREATE_IN_PROGRESS | Resource creation Initiated |
| 2019-10-25T09:36:30.725Z| AppBucket | AWS::S3::Bucket | CREATE_IN_PROGRESS | None |
| 2019-10-25T09:36:28.593Z| jhw-hello-world | AWS::CloudFormation::Stack | CREATE_IN_PROGRESS | User Initiated |
| 2019-10-25T09:36:23.314Z| jhw-hello-world | AWS::CloudFormation::Stack | REVIEW_IN_PROGRESS | User Initiated |
+--------------------------+------------------+-----------------------------+----------------------+-------------------------------+
justin@justin-XPS-13-9360:~/work$ ./describe_resources.sh
----------------------------------------------------------------------------------------------------------------------------------------------
| DescribeStackResources |
+--------------------------+------------------+-------------------------------------------------+------------------------+-------------------+
| 1.Timestamp | 2.LogicalId | 3.PhysicalId | 4.Type | 5.Status |
+--------------------------+------------------+-------------------------------------------------+------------------------+-------------------+
| 2019-10-25T09:36:52.867Z| AppBucket | jhw-hello-world | AWS::S3::Bucket | CREATE_COMPLETE |
| 2019-10-25T09:36:56.388Z| AppBucketPolicy | jhw-hello-world-AppBucketPolicy-1HHRU891O0FMJ | AWS::S3::BucketPolicy | CREATE_COMPLETE |
+--------------------------+------------------+-------------------------------------------------+------------------------+-------------------+
justin@justin-XPS-13-9360:~/work$ ./describe_outputs.sh
----------------------------------------------------------------------------
| DescribeStacks |
+-----------+--------------------------------------------------------------+
| OutputKey | OutputValue |
+-----------+--------------------------------------------------------------+
| BucketURL| http://jhw-hello-world.s3-website-eu-west-1.amazonaws.com |
+-----------+--------------------------------------------------------------+
justin@justin-XPS-13-9360:~/work$ ./delete_stack.sh
delete: s3://jhw-hello-world/index.html
justin@justin-XPS-13-9360:~/work$ ./describe_stacks.sh
--------------------------------------------------------------------------------
| DescribeStacks |
+-----------------------------------------------------------+------------------+
| 1.Name | 2.Status |
+-----------------------------------------------------------+------------------+
| #{an-existing-stack} | UPDATE_COMPLETE |
+-----------------------------------------------------------+------------------+
justin@justin-XPS-13-9360:~/work$