Invalid CORS request: JHipster registry on Azure webapp - jhipster

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

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'

Related

Web application no longer restarts automatically on Azure WebApps on TOMCAT server : HTTP 404

My applications were working properly on Azure, but after a Microsoft Docker update, they don't all restart automatically.
I have an HTTP 404:
My analysis :
This application was deployed with Microsoft tools
az webapp deploy ...
in log : /home/DeploymentLogStream/ xxx.log
the application is deployed correctly and it is present on file system
...
"Clean deploying to /home/site/wwwroot/webapps/wholesale"}
"Generating deployment script."}
"Using cached version of deployment script (command: 'azure -y --no-dot
"Running deployment command..."}
"Command: \"/home/site/deployments/tools/deploy.sh\""}
"Handling Basic Web Site deployment."}
....
"Requesting site restart"}
"Requesting site restart. Attempt #1"}
"Successfully requested a restart. Attempt #1"}
"Deployment successful. deployer = OneDeploy deploymentPath = OneDeploy
In Docker Log file I see an update of Microsoft image :
675db21ca06b Extracting 133B / 133B
675db21ca06b Extracting 133B / 133B
675db21ca06b Pull complete
Digest: sha256:932deb9018db39b74249774b4206906424f3fea09b791e9318c43316dc695aff
Status: Downloaded newer image for mcr.microsoft.com/azure-app-service/tomcat:8.5-jre8_220406005815
Pull Image successful, Time taken: 1 Minutes and 11 Seconds
Starting container for site
docker run -d -p 8871:80 --name ..
Container ... initialized successfully and is ready to serve requests.
But in Tomcat log File I only see the default ROOT module and not my Web application.
and indeed my app is not copy from /home/site/wwwroot/webapps/wholesale to /usr/local/tomcat/webapps/wholesale
/usr/local/tomcat/webapps
Redeployment does not change the problem.
Multiple restarts solve the problem but without understanding why.
The workaround is to manually copy the directory from /home to /usr, but next update will remove it.
Someone has an idea to solve the problem ?
Apologies for the inconvenience with this issue and delayed response here.
Users using the auto-update version of Tomcat on Linux that deploy multiple applications in the webapps directory may see their apps return 404.
You may manually change the version to respective working version:
Tomcat 8.5: 8.5.72
Tomcat 9.0: 9.0.54
Tomcat 10.0: 10.0.12
You may also check Azure Service Health history, notification info.
Kindly let us know how it goes.

How Azure pipelines can get source from Internal TFS and External Git? How can I update the proxy?

I am setting up Azure Pipelines, I have few that get sources from GitHub and trying to setup pipelines to reach TFS on Intranet, I created a Service Connection of type: “Azure Repos/Team Foundation Server” using this Other Git URL: https://tfs.myCie.com/defaultcollection/MyProject/_versionControl
When I run the pipeline, it takes some time then it displays a 504 Timeout error but the pipeline is still pending. After a while, it goes into error with this message in the step “Checkout repository#master to s”:
git -c http.proxy="http://myProxy.myCie.com:80" fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: unable to access 'https://tfs. myCie.com/defaultcollection/myProject/_versionControl/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to tfs.oecd.org:443
##[warning] Git fetch failed with exit code 128, back off 3.667 seconds before retry.
Security team says that I should use a PAC file to setup the proxy and that should enable intranet and Internet calls but I don’t see how to update the proxy settings of my Self-Hosted Windows Agent.
Can I specify a file? Can there be a configuration for Internet and another one for intranet?
I don’t see how to update the proxy settings of my Self-Hosted Windows
Agent. Can I specify a file?
For the agent you need to create a .proxy file with the proxy URL in the root directory of your agent.
Locate the root directory of your build agent (this is the folder
that contains the run.exe and the _work folder).
Open a Command Prompt at this location.
Type this command, but replace PROXYIP & PORT with your values:
echo http://PROXYIP:PORT > .proxy
Check that your .proxy file is created at the right place:
Optional: If your proxy needs authentication, you must set these
environment variables:
set VSTS_HTTP_PROXY_USERNAME=user
set VSTS_HTTP_PROXY_PASSWORD=password
Restart the service for your build agent.
When you know that you need a proxy at the time of the installation, you can configure the proxy settings right when you call config.cmd:
./config.cmd --proxyurl http://127.0.0.1:8888 --proxyusername "user" --proxypassword "password"
For details, please refer to this blog.
Here is the official document you can refer to.

How to deploy shield with Kibana on Bluemix

I am trying to deploy Kibana on Bluemix PaaS. Because Kibana is a Node.js application, it can be deployed as such on Bluemix. All i have to do:
Provide a simple manifest.yml file that details the app name and a couple of other things
Provide a Procfile that has just one line as web: bin/kibana --port=$PORT
Thus, I can run Kibana on Bluemix. Note that this is pushed via Cloud Foundry.
Also, I was able to install the marvel and sense plugins for Kibana.
Now, I installed the shield plugin. This plugin requires an ssl key and an ssl cert file to run. The path to these files must be provided in the kibana.yml file.
After installation, I tested the shield plugin natively and it worked just fine.
Here is the layout of the directory structure:
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
(d) represents directories. The sslFiles folder contains the ssl key and ssl cert files.
Before I could push to Bluemix, I knew that the paths to the SSL files would have to be relative to the app in Bluemix. Thus, in the kibana.yml file, I specified them as:
kibana.ssl.key:app/sslFiles/kibana.key
kibana.ssl.cert:app/sslFiles/kibana.cert
I did this as in Bluemix, I could see the following directory structure:
app(d)
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
Indentation represents containment. So, I pushed it to Bluemi using Cloud Foundry, but now I get a 502 Bad Gateway: Registered endpoint failed to handle the request error. I tried changing the paths to sslFiles/kibana.key but then I got a cannot find path sslFiles/kibana.key staging error.
What is responsible for my 502 error? Is it the path to the sslFiles? If so, how can I properly provide the paths?

Proxy configuration for OpenShift Origin

I am setting up an OpenShift origin server. The configurations I do heavily relies on the walkthrough description:
https://github.com/openshift/origin/blob/master/examples/sample-app/README.md
After creating a project, I add a new app like this (successfully):
oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-hello-world.git
OpenShift tries to build immediatelly, only to fail as follows:
F0222 15:24:58.504626 1 builder.go:204] Error: build error: fatal: unable to access 'https://github.com/openshift/ruby-hello-world.git/': Failed connect to github.com:443; Connection refused
I consulted the documentation about the proxy configuration:
https://docs.openshift.com/enterprise/3.0/admin_guide/http_proxies.html#git-repository-access
Concluded that I can simply edit the YAML descriptor for this specific app to include my corporate proxy.
...
source:
type: Git
git:
uri: "git://github.com/openshift/ruby-hello-world.git"
httpProxy: http://proxy.example.com
httpsProxy: https://proxy.example.com
...
With that change the build proceeds.
Can the HTTP proxy be configured system wide?
Note: again, I simply downloaded the binaries (client, server), did not install via ansible. And I did not find relevant properties openshift.local.config folder, inside my server binary folder.
After some time I now know enough to answer my own question.
There are two places where one needs to deal with corporate proxy settings.
Docker
This thread will tell you what to do in detail:
Cannot download Docker images behind a proxy
In my case on RHEL 7.2 I needed to edit this file: /etc/sysconfig/docker
I had to add the following entries:
HTTP_PROXY="http://proxy.company.com:4128"
HTTPS_PROXY="http://proxy.company.com:4128"
Then a restart of the docker service was necessary.
Origin Proxy
What I missed originally was the place to configure our corporate proxy settings. Currently I have a cluster (1 master, 1 node) installed via ansible.
These are the relevant files to edit on the servers:
* /etc/sysconfig/origin-master
* /etc/sysconfig/origin-node
There already placeholders in this file:
#NO_PROXY=master.example.com
#HTTP_PROXY=http://USER:PASSWORD#IPADDR:PORT
#HTTPS_PROXY=https://USER:PASSWORD#IPADDR:PORT
Documentation:
https://docs.openshift.org/latest/install_config/http_proxies.html

why toran generate package json with domain : examle.org?

I do as toran proxy document step by step, but i occur a problem
I have configure toran_host and toran_prot in parameters.yml, but generated package josn remain using the the domain
example.org
Package.json
I try to find issue source, but the application is too complex for me.
this is my parameters.yml:
parameters:
# this secret should be changed to something unique and random if possible
secret: ThisTokenIsNotSoSecret-Change-It
# http or https depending on your hosting setup
toran_scheme: http
# in case you use non-standard ports you can update them here
toran_http_port: 91
toran_https_port: 443
# the hostname toran is hosted at
toran_host: 121.199.35.34:91
# e.g. /foo if toran is hosted in a sub-directory, or leave it empty if it is on its own domain, no trailing slash!
toran_base_url:
but have you tried clearing the cache? Delete
everything in ·app/cache/· and try again, because the parameters need to
be set correctly before the cache is created otherwise it is not rebuilt.
this answer come from Jordi's email to me, he is a author of toran, thank for nice and hard work .
You have to modify your config file at app/config/parameters.yml:
# the hostname toran is hosted at
toran_host: example.org
Then delete the production cache at app/cache/prod, and finally run the cron job again php bin/cron -v
For further instructions follow official installation documentation here: https://toranproxy.com/download

Resources