自从我开始开发我的应用程序以来,这个特殊的问题就被搁置了。
现在随着SEO的要求之一,它真的引起了我的注意。
我有一个使用https的反应应用程序。例如https://www。theoptionslab。com。同样的应用程序也托管了一些API,如这个API: http://www。theoptionslab。com/verify/?action=member_registration&token=bc80b43c-41d1-5b56-b384-20ebcbdd4f63。
然而,在我使用“heroku-ssl-redirect”来强制所有的流量从http到https,以满足SEO要求之一,任何访问api像这样:http://www。theoptionslab。com/verify/?action=member_registration&token=bc80b43c-41d1-5b56-b384-20ebcbdd4f63将被转发到主页https://www。theoptionslab。com,这意味着现在将无法访问任何api。
同样的问题之前,我可以访问图像的公共文件夹,如http://www。theoptionslab。com/2D。png,现在它只是转发请求https://www。theoptionslab。com,我不再能够访问这些图像。
的确,我无法通过https访问图像或API,甚至在“heroku-ssl-redirect”更改之前。现在更改后,我不能访问他们,甚至与http,因为强制重定向。
所以我别无选择,只能回滚“heroku-ssl-redirect”实现。
看看这个问题是怎样的:
试试这个:http://www。theoptionslab。com/2D。png这就是我所期望的。
vs。 this: https://www。theoptionslab。com/2D。png这不是我所期望的。
试试这个:http://www。theoptionslab。com/verify/?action=member_registration&token=bc80b43c-41d1-5b56-b384-20ebcbdd4f63这就是我所期望的。
vs。 this: https://www。theoptionslab。com/verify/?action=member_registration&token=bc80b43c-41d1-5b56-b384-20ebcbdd4f63这不是我所期望的。
有人遇到过同样的问题吗?我可以通过https访问api或图像吗?或者有什么方法可以使用“heroku-ssl-redirect”,同时仍然保持http://www。theoptionslab。com/2D。png的可访问性?
我看到有人有一个类似的问题提到在这里https://serverfault。com/questions/637882/forcing-https-redirect-is-rewriting-all-urls-to-root-directory-and-not-appending但不完全相同。
任何建议将非常感谢!