Fetch get timeout using React and Rails backend

rails

#1

I build an application with React and Rails. I can use previews to view both of them running. But when I tried to connect Rails and React, get data from Rails backend using fetch function. It gives me timeout. I followed the instruction of setting preview url to public ip but seems not solving my problem. Anyone have the same issue? Please help me out. Thank you
componentDidMount() {
fetch(“https://18.219.2.46:8080/api/nextstops”).then((response) => {
if (response.ok) {
console.log(response)
return response.json();
} else {
throw new Error(‘Something went wrong’);
}
})
.then(
nextstops => this.setState({nextstops})
)
.catch((error) => {
console.log(error)
});