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

Support for Internationalized (i18n) automatic locale detection #3320

Closed
4 tasks done
ArianHamdi opened this issue Feb 21, 2023 · 12 comments
Closed
4 tasks done

Support for Internationalized (i18n) automatic locale detection #3320

ArianHamdi opened this issue Feb 21, 2023 · 12 comments
Labels
archived This issue has been locked. compute custom-headers feature-request New feature or request

Comments

@ArianHamdi
Copy link

Before opening, please confirm:

App Id

d2kp69mengqx1w

AWS Region

us-east-1

Amplify Hosting feature

Deployments, SSR

Question

Our next.js 13 application is being migrated to the new amplify hosting compute platform.
We need to configure cloud front for two reasons:
1: to redirect "domain.com/restApi/*" to the API gateway so that they won't be resolved in Amplify Hosting.
2: to get the 'Accept-Language' header in middleware to display the website in the user's preferred language.

We previously added path behavior to cloudfront to point "/restApi/*" to an API gateway and let cloudfront distribution allow "Accept-Language" header.

As of now, amplify has full control over cloudfront and we are unsure how to resolve this issues.

Thanks in advance

@ArianHamdi ArianHamdi added the question Further information is requested label Feb 21, 2023
@ghost ghost self-assigned this Feb 21, 2023
@ghost ghost added compute feature-request New feature or request and removed question Further information is requested labels Feb 21, 2023
@github-actions
Copy link

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@ghost
Copy link

ghost commented Feb 23, 2023

Hi @ArianHamdi 👋🏽, thanks for raising this question and explaining your use case for these configurations. We do not support modifications to the CloudFront distribution at this time since it is managed by Amplify with the new compute platform. However, we are tracking this as a feature request.

@ghost ghost added custom-headers and removed compute labels Feb 23, 2023
@ArianHamdi
Copy link
Author

ArianHamdi commented Feb 28, 2023

Hi @hloriana.
Amplify support for Next.js SSR points to automatic locale detection, but I was not able to implement it.

next.config.js has a localeDetection option that automatically redirects users to their preferred language, but the feature does not work on Amplify.

It seems to rely on Accept-Language header, which seems to be blocked by Amplify (It's unclear to me).

On introduce amplify for next.js, I'm not sure why automatic locale detection is added if this header is blocked.

//next.config.js

i18n: {
    locales: ["en", "sv"],
    defaultLocale: "en",
    localeDetection: true
}

Please let me know if this comment needs a new issue.

@vafPER
Copy link

vafPER commented Mar 2, 2023

@hloriana Do you have any updates about the headers? Http request headers like "Accept-Language" or "Referer" seems not to be passed through Amplify Host. We are stuck in development after migrating our front end to Amplify.

@vafPER
Copy link

vafPER commented Mar 8, 2023

@hloriana It's hilarious and at the same time sad that we got to know today that what was written in AWS Amplify doc was wrong and Automatic locale detection for Next Js is not supported yet. At least we managed to make them correct their official page :

https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplify-support.html

so no other team falls into the trap of spending days on finding the cause of an error which is written wrongly as a supported feature.

@ghost ghost removed their assignment Apr 14, 2023
@burkayanduv
Copy link

Are there any updates on this?

Everything was seamless for hosting Next.js app with Amplify until we have learned the accept-language headers were stripped off from requests by CloudFront and there is no way to configure this behavior. We will stick with Vercel until this one is fixed. Hope this issue is resolved in a timely manner.

@Jay2113 Jay2113 changed the title Configure cloudfront on amplify Support for Internationalized (i18n) automatic locale detection Oct 3, 2023
@Jay2113 Jay2113 added the compute label Oct 3, 2023
@gstrobl
Copy link

gstrobl commented Nov 14, 2023

Any updates for this feature?

@mdillgen
Copy link

mdillgen commented Feb 7, 2024

+1 This feature request is very important and the lack of language detection (in my case handled by middleware inside of Next.js 14) is what is currently holding me back from hosting on amplify.

@snaps-jacob
Copy link

try 'cloudfront-viewer-country' field
but it is not perfect.

@mauerbac
Copy link
Member

This feature has just been supported with our latest launch! Closing.

Check out the details here: https://aws.amazon.com/blogs/mobile/cdn-caching-improvements-for-better-app-performance-with-aws-amplify-hosting/

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Aug 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. compute custom-headers feature-request New feature or request
Development

No branches or pull requests

8 participants