'Invalid CORS request: JHipster registry on Azure webapp
I am trying to deploy default Jhipster-registry executable Jar file on Azure webapp. The applications starts and I can see the login page. However, when I put username/password and hit submit, I get error:Invalid CORS request (403 forbidden)
I see that api/authenticate
service is called. I also tried to deploy default docker image on azure webapp with docker. It also gives exactly same issue.
Basically I want to deploy Jhipster microservices along with the registry on Azure webapps because I am used to it. I expect that being normal Spring boot web application, it should be possible to achieve this.
Any help is appreciated.
regards, Venky
Solution 1:[1]
Try modifying the "application-dev.yml" file.
Comment all lines related to "CORS"
# CORS is only enabled by default with the "dev" profile
# cors:
# Allow Ionic for JHipster by default (* no longer allowed in Spring Boot 2.4+)
# allowed-origins: 'http://localhost:8100,https://localhost:8100,http://localhost:9000,https://localhost:9000,http://localhost:4200,https://localhost:4200'
# Enable CORS when running in GitHub Codespaces
# allowed-origin-patterns: 'https://*.githubpreview.dev'
# allowed-methods: '*'
# allowed-headers: '*'
# exposed-headers: 'Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params'
# allow-credentials: true
# max-age: 1800
Or if you prefer include your deploy location in "allowed-origin-patterns:".
In my case I added gitpod.
allowed-origin-patterns: 'https://*.githubpreview.dev,https://*.gitpod.io'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Diego Lima da Costa |