Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entire URL gets suffixed to redirect key #81

Closed
jariz opened this issue Jun 26, 2019 · 2 comments · Fixed by #82
Closed

Entire URL gets suffixed to redirect key #81

jariz opened this issue Jun 26, 2019 · 2 comments · Fixed by #82

Comments

@jariz
Copy link
Collaborator

jariz commented Jun 26, 2019

@gburgett @JoshuaWalsh
I don't fully understand what's happening here or why it's needed:

https://github.com/jariz/gatsby-plugin-s3/blob/a8705502d0f71cacaabc2d2a87e2464e16df616e/src/gatsby-node.ts#L114-L120

This seems rather unnecessary because S3 will already prepend the url if a hostname+protocol is provided (that's the whole reason why we provide these fields to the routingrules), we do not need to do that ourselves.

I'm fairly sure this is what's causing the domain to get prepended twice for me right now.
Downgrading to 0.2.3 fixes it.

curl -I -L https://[domain]/l/craft-cms

HTTP/2 301
content-length: 0
location: https://[domain]/[domain]/techniek/craft-cms

HTTP/2 404
content-length: 0
x-amz-error-code: NoSuchKey
x-amz-error-message: The specified key does not exist.
x-amz-error-detail-key: https://[domain]/[domain]/techniek/craft-cms
@YoshiWalsh
Copy link
Collaborator

Damn, sorry for letting that one slip through. That block is only necessary for when generateRedirectObjectsForPermanentRedirects is enabled. Moving it to within this if statement should fix the problem, although moving the logic into here might be cleaner.

I'm not sure how I missed this in testing, since protocol/hostname are features I use myself. I must not have been thorough enough when testing with generateRedirectObjectsForPermanentRedirects disabled, sorry.

@YoshiWalsh
Copy link
Collaborator

Working on a fix now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants