1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

簡単にhttps化できる「あ、このテストhttps対応してないとできないテストやん!」って時に使えるものを作りました

1
Last updated at Posted at 2019-08-27

あ、このテストhttps対応してないとできないテストやん!って時に使えるものを作りました

コードをいじりたくない時に使ってください
このレポジトリで見てください
https://github.com/takashiAg/https_easiest_proxy

経緯

streamingAPIとか使用する場合、その他テストをするときにhttps対応してないとできなかったりする。
選択肢としては、

  • テスト用にhttps対応コードをかく
    • 本番環境へのケースの切り分けが面倒
    • 詳しくやり方がわからない
  • Apacheやnginxでリバースプロキシを設定する
    • 証明書の発行
    • httpsに対応するようapacheインストール
    • 設定ファイルの作成

が必要になるますが、面倒ですよね。

WAN=80 LAN=3000 node proxy.jsと書けば、プロキシとして動作するものを作りました。(bash)

installation

git clone https://github.com/takashiAg/https_easiest_proxy
cd https_easiest_proxy
npm install
openssl genrsa 2048 > mysslserver.key
openssl req -new -key mysslserver.key -subj "/C=JP/ST=Tokyo-to/L=Shibuya/O=Company Name/OU=IT dept./CN=Company Dept CA" > mysslserver.csr
openssl x509 -days 3650 -req -signkey mysslserver.key < mysslserver.csr > mysslserver.crt
openssl pkcs12 -export -inkey mysslserver.key -in mysslserver.crt > mysslserver.pfx

start

node proxy.js

change port

WAN=80 LAN=3000 node proxy.js
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?