Configurazione origini CORS non funziona

I want to embed the latest updates from our community on my website:

To accomplish this, I am trying to access the latest.json and will parse that appropriately and embed on my site:

I went to admin and setup the CORS origins:

I even updated app.yml with the following lines and rebuild the whole thing:
DISCOURSE_ENABLE_CORS: true
DISCOURSE_CORS_ORIGIN: ‘https://www.schulminator.com/’
I don’t know if this is needed but it does work with this setting or without.

But still same issue as you check on this site:

Access to XMLHttpRequest at ‘https://community.schulminator.com/latest.json’ from origin ‘https://www.schulminator.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I am really stuck here…

3 Mi Piace

Same problem here
Has someone been able to get it work?

3 Mi Piace

Se qualcuno ha un problema simile con una configurazione CORS, controlla di aver rimosso la barra finale dal tuo link. Un errore stupido che mi è costato un paio d’ore. :sweat_smile:

5 Mi Piace

Penso che il suggerimento sulle impostazioni CORS dovrebbe essere reso decisamente piĂš chiaro:

Testo attuale

Origini consentite per le richieste cross-origin (CORS). Ogni origine deve includere http:// o https://. La variabile d’ambiente DISCOURSE_ENABLE_CORS deve essere impostata su true per abilitare CORS.

Proposta di bozza

Origini consentite per le richieste cross-origin (CORS). Ogni origine deve includere http:// o https:// e non deve avere una barra finale. La variabile d’ambiente DISCOURSE_ENABLE_CORS deve essere impostata su true per abilitare CORS.

A proposito, come si potrebbe creare una PR per una cosa del genere? Dovrebbe modificare solo la locale inglese qui e le traduzioni saranno gestite altrove (ad esempio tramite Transifex), o anche le traduzioni dovrebbero essere incluse nella PR?

2 Mi Piace

Se la barra finale è un problema, il nostro codice dovrebbe rimuoverla automaticamente @sam.

6 Mi Piace

@vinothkannans puoi modificarlo in modo che qui rimuoviamo automaticamente la barra finale?

3 Mi Piace

Questo è stato risolto nella PR qui sotto

4 Mi Piace