Home react always redirect to homepage
Reply: 0

react always redirect to homepage

user984
1#
user984 Published in May 28, 2018, 9:49 am

First of all I'm new to react, so i'm still learning about it.

I got this problem with react if I make a hyperlink from another domain/site to react app on localhost, eg http://localhost:8089/foo/bar. it show the correct page directly but if I make a hyperlink from another domain/site to a public domain with https protocol eg https://example.com/foo/baz it always redirected to homepage page (https://example.com/)

is there anything I can do to make it go straight to https://example.com/foo/baz. I run react on nginx web server with this redirection setting it went well for php, django etc but won't run with react.

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com;
    return 301 https://$server_name$request_uri;
    root /home/[path to dist folder]/web/app/dist;
    index index.html index.htm;

}

FYI the react app is build with webpack thanks in advance

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.443592 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO