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?

unityroomからアクセスするlolipopに置いたphpのCORS設定

Posted at

CORS設定の備忘録です。

UnityWebRequestとのやりとりはjsonで行う場合を想定。

unityroomにゲームをアップロードすると
ゲームごとに番号(5桁?)が割り当てられるようです。

php側で
https://[ゲームの番号].play.unityroom.com
というURLからのブラウザアクセスを許可します。

<?php
header("Access-Control-Allow-Origin: https://[ゲームの番号].play.unityroom.com");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: Content-Disposition, Content-Type, Content-Length, Accept-Encoding");
header("Content-type:application/json");

// ここにDBアクセスなどの処理と結果のjson出力を行うコードを書く
?>
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?