I want to redirect to another domain in nginx, but it becomes a directory in my domain.

Asked 2 years ago, Updated 2 years ago, 46 views

nginx is trying to redirect access to s3 under assets.

location~*^/assets{
    return301 https://s3-ap-northeast-1.amazonaws.com/hoge-assets$request_uri;
    break;
}

Location returned the desired path.

response

However, Chrome ended up accessing "Path with Location value under the original domain".

Enter a description of the image here

Chrome and Firefox both behaved the same way, so I think it may be caused by nginx or html, not browser.The html is as follows.

<link rel="stylesheet" media="all" href="/assets/application-d07f97160f917fd45d04dc4f95823689.css"data-turbolinks-track="true"/>

Notes

Also, I understand that the URL should be embedded when rendering html, but
Due to historical background, we are considering redirecting to nginx.

html nginx

2022-09-29 22:25

1 Answers

Probably not "https://" (not a single slash).


2022-09-29 22:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.