** At the company I work for, I can't access Qiita because of a proxy. ** **
When I listen to the story at a study session, I hear that there is a company with an unexpectedly similar environment. But by all means ** "I want to see Qiita at the company !!" **
One day, when I consulted with a person who was attending an AWS study session, I got a good idea. Recently, I was studying AWS, so I implemented it.
The simple flow of the created service is to pull out the page information of Qiita you want to see and relocate it to a place that can be accessed from within the company. By the way, if you can't access AWS from within your company, you're out.
This time, we use three main services on AWS. Detailed explanation of each service is omitted.
The request is as follows when viewing the article at https://qiita.com/guromityan/items/5846fcefd87abcf76f7f.
In target
, specify the URL of the article you want to see.
https://<API Gateway>.ap-northeast-1.amazonaws.com/previewQiita?target=https://qiita.com/guromityan/items/5846fcefd87abcf76f7f
The response looks like this:
{
"statusCode": 301,
"headers": {
"Location": "https://<S3 Bucket>.s3-ap-northeast-1.amazonaws.com/guromityan/5846fcefd87abcf76f7f"
}
}
Because of " sutatusCode ": 301
, the browser that receives it redirects to the URL specified in the Location
header. The transition destination is a page that exposes the S3 object converted from Markdown to html as static content.
By the way, I made a Chrome extension and rewrote the URL to Qiita to automatically hit API Gataway. I will write that story someday.
What I wanted to talk about this time is that I have such an idea, so I will omit the explanation of how to set up AWS services.
The source code of Lambda is published on [GitHub] guromityan / previewQiita, so if you want to do it, please use it.
** [Caution] ** In order to use it with Lambda, it is necessary to zip the dependent libraries together, so please drop the dependent libraries locally with
docker-compose build
etc.
Recommended Posts