首页 > 解决方案 > React GET 请求在末尾添加字符

问题描述

我正在尝试创建一个代理服务器,它将使用 Amazon EC2 上部署的服务来渲染照片。每当我连接到服务器并加载页面时,这是我得到的错误消息:

获取http://127.0.0.1:55055/restaurant/65/%3C 404(未找到)

获取http://127.0.0.1:55055/restaurant/65/!404(未找到)

获取http://127.0.0.1:55055/restaurant/65/D 404(未找到)

获取http://127.0.0.1:55055/restaurant/65/O 404(未找到)

获取http://127.0.0.1:55055/restaurant/65/C 404(未找到)

在我的代码中,获取请求是http://ec2-34-201-243-233.compute-1.amazonaws.com/restaurant/${restaurantId}

为什么随机字符(%3C、!、D 等)添加到 url 的末尾,如何防止这种情况发生?

这是我的 HTML:

<body>
    <div id="Photos"></div>
    <script src="https://s3-us-west-1.amazonaws.com/my-bucket-name/bundle.js"></script>
    <script>

        ReactDOM.render(
            React.createElement(Photos),
            document.getElementById('Photos')
        );

    </script>
</body>

标签: htmlreactjsservergetproxy-server

解决方案


推荐阅读