when HTTP method not specified for requestMapping, it allows all methods:
spring security with multiple authprovider and userDetailService
in order to load and auth user from multiple system, the HttpSecurity (`rg. springframework. security. config. annotation. web. builder`) or AuthenticationManager can concatenate multiple provider and user service, like
alternatively
intellij disable formatter
within the IDE, the specific block could be excluded from formatting via
so code like this wont be formatted:
//@formatter:off
cloud foundry ssh
while ssh into the container, it could fail opening the ssh connection.
the status of ssh enablement could be checked and enabled.
--check whether ssh is enabled
cf ssh-enabled <APP>
--enable app ssh
cf enable-ssh <APP>
maven multi module with both front end and backend
follow up to https://lwpro2.wordpress.com/2011/09/20/maven-multi-module/
for maven multi module project with both front end and back end, there are two ways to run the app:
- if it’s exploded, the front end and back end application can run separately, eg 1 nodejs app for front end, 1 separate java spring boot process for the backend; for this approach to direct the traffic from front end to back end, it require a proxy
//for example, for angular, this could be
//package.json
"run_local": "ng serve --proxy-config proxy.conf.json"
//where proxy.config.json would be
{
"/api":
{
"target": "http://localhost:3000",
"secure": false
}
}
//or
{
"/api":
{
"port": "3000",
"secure": false
}
}
source:
front end proxy: https://create-react-app.dev/docs/proxying-api-requests-in-development/
https://angular.io/guide/build#proxying-to-a-backend-server
2. if it’s packaged(uber jar)/not-exploded or to run both front end and backend in single process whether exploded or not, then the front end can be built (with the assets moved either static/public:
Spring Boot comes with a pre-configured implementation of ResourceHttpRequestHandler to facilitate serving static resources.
By default, this handler serves static content from any of the /static, /public, /resources, and /META-INF/resources directories that are on the classpath.
), which can packaged as a separate jar for example. As long as the /static, /public folder is top level at the jar
as such, when backend (spring boot application start), it (the embedded tomcat for example) would serve both the backend (spring MVC) and front end (through above: ResourceHttpRequestHanlder).
ref: https://ashokgurudayal.hashnode.dev/multi-module-projects-and-packaging-frontend-backend-together
when maven package the jar, the /static folder would become top level of the package (/target/classes are removed)
ref: https://ashokgurudayal.hashnode.dev/multi-module-projects-and-packaging-frontend-backend-together
cloud foundry login issue with sap
i have face a lot of issues connecting sap cloud foundry from cf cli. the issue includes, failed authentication, unauthorized, locked password etc.
the solution, turns out is to use `
`cf login –sso, which would use the temporary authentication code from the API, which worked.
source:
https://community.sap.com/t5/technology-q-a/cloud-foundry-login-error/qaq-p/12477996
code deploy to ECS task definition
there is a trick in the AppSpec.yml file when using code deploy to push the deployment to ECS. the TaskDefinition should be “<TASK_DEFINITION> this will be replaced by codeDeploy.
placeholder replaced by code deploy
git for aws codecommit
for git ssh connection to AWS code commit, after uploading the public key, the trick is to have a specific config file to tell the user/public_key_id to associate with code commit
- upload the existing ssh key
run `cat ~/.ssh/id_rsa.pub| pbcopy
`
2. add the special conf file
3. then run ssh git-codecommit.us-east-2.amazonaws.com for testing
ref: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html
S3 notification event
when creating a S3 event notification to SNS, the AWS throw out an error saying
turns out this is due to the access policy on SNS, which needs to be updated to point to the right S3 bucket.
After correcting the policy, it worked.
test ALB connection over NLB
to test the http connection over TCP, first establish the TCP connection, then issue the GET command
with telnet similar to NC: