У меня есть приложение, написанное на ReactJs, которое развернуто на AWS. Все работает отлично, но я с чем-то борюсь.
Каждый раз, когда я обновляюсь на определенном пути, например www.domainname.com/path/path. Он перенаправил меня на www.domainname.com/index.html
. Я понял, что это как-то связано с моими перенаправлениями на AWS ampify.
So, I tried changing the 404 (Redirect) to 404 (Rewrite), which worked.
even though it worked, this gave me another problem. If I refresh the page on the example www.domainname.com/path/path снова, и я смотрю на сетевую консоль в браузере. Я вижу, что загружаемая страница получает ошибку 404 Not Found, хотя страница загружается.
This error causes annoying things for example I put my link in a powerpoint presentation, upon trying to open this. I get an error message that it cannot be found (404)
I don't get this error on localhost, only on my domains
Here is my routing in React
import { BrowserRouter, Route, Switch } from "react-router-dom";
import React from "react";
const App = () => {
const search_slug_options = [
`/${search}/${page}=:page?/:id?`,
`/${search}/:value_1?/:value_2?/${page}=:page?/:id?`,
`/${search}/:value_1?/${page}=:page?/:id?`,
`/${search}/:value_2?/${page}=:page?/:id?`,
`/${search}/:value_1?/:value_2?/:id?`,
`/${search}/:value_1?/:id?`,
`/${search}/:value_2?/:id?`
]
return (
} />
{search_slug_options.map((path, index) => } />)}
} />
} />
} />
} />
} />
);
}
export default App;
This is all out of my domain as I'm just a starting frontender.
Any clues? ideas? solutions?
Edit: Maybe notable to say, the Redirect line was automaticly added by AWS amplify, upon removing this, and refreshing my browser, I get this error:
введите описание изображения здесь