How to disable memory routing for my react app routed through goDaddy deployed using nginx on AWS EC2 instance?

huangapple go评论65阅读模式
英文:

How to disable memory routing for my react app routed through goDaddy deployed using nginx on AWS EC2 instance?

问题

我在React中没有使用Memory Router。我的所有路由都使用BrowserRouter。

当该应用程序部署到AWS EC2实例并通过其IP地址进行检查时,通过React应用程序进行遍历时,我可以看到完整的URL。

在将我的DNS域映射到我的IP地址后,需要相同的行为,但是当我这样做时,我们使用内存路由,因此在遍历我的React应用程序时URL不会更改。

Nginx配置看起来像这样:

upstream react{
    server react-frontend:3000;
}

server {
   listen 80;
   server_name subdomain.domain.com;

   location / {
       proxy_pass http://react;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $host;
       proxy_redirect off;
   }
}

解决方案应该与在GoDaddy中禁用内存路由有关。只是我似乎无法找到与这个特定问题相关的资源。

英文:

I am not using Memory Router in react. All of my routing is using BrowserRouter.
When the app is deployed on the AWS EC2 instance and its behaviour is checked through its IP address, I see the complete url when traversing through the react app.
Same behaviour is required after mapping my DNS domain to my IP address, but when I do that, we have memory routing such that url does not change when traversing through my react app.
Nginx configuration looks something like this.

upstream react{
    server react-frontend:3000;
}

server {
   listen 80;
   server_name subdomain.domain.com;

   location / {
       proxy_pass http://react;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $host;
       proxy_redirect off;
   }
}

The solution should have something to do with disabling memory routing within GoDaddy. Its just that I cant seem to find the relevant resources for this particular issue.

答案1

得分: 0

Turns out it was indeed an issue with GoDaddy. We switched to Amazon Route 53 and the issue resolved itself.

英文:

Turns out it was indeed an issue with GoDaddy. We switched to Amazon Route 53 and the issue resolved itself.

huangapple
  • 本文由 发表于 2023年3月7日 15:41:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659150.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定