angular 权限 php,PHP,Angular,HTACCESS-仅允许来自源域的请求
我完成了我的角度項目。
在我的項目中,我向PHP文件發送帶有數據的POST請求,然后將結果返回給Angular。
現在我只允許來自源域的請求,并拒絕來自任何域的請求。
我嘗試使用:header("Access-Control-Allow-Origin: example.com");
但不管用。 我不想使用$_server['HTTP_REFFER'],因為它可以被操縱。 我也嘗試過使用。htaccess,但我不知道如何實現。 我試過這樣的方法:order deny, allow
deny from all
allow from mydomain.com
但不管用。
我的項目已經具有以下。htaccess文件:RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
取自:https://angular.io/guide/deployment#routed-apps-must-fallback-to-indexhtml
我能做什么?
謝謝。
總結
以上是生活随笔為你收集整理的angular 权限 php,PHP,Angular,HTACCESS-仅允许来自源域的请求的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小程序 webview 分享_新的一周,
- 下一篇: Matplotlib - 箱线图、箱型图