nestjs swagger-ui SSL_PROTOCOL_ERR on centos 7 - https

When connecting to swagger from a local PC after npm start
API PATH : 'api'
Request URL: http://localhost:11002/api/
Request URL: http://localhost:11002/api/swagger-ui-bundle.js
swagger docs web opens normally!
I configured the same project on centos7.
API PATH : 'api'
Request URL: http://10.62.130.54:11002/api/
Request URL: https://10.62.130.54:11002/api/swagger-ui-bundle.js
swagger docs web does not open!!
=>> SSL PROTOCOL ERROR
Why are you trying with https?
thanks!!
-
#nestjs/swagger#5.2.1
swagger-ui-express#4.5.0

Related

Error on executing http rest by the gateway 502

I'm working on a spring cloud application
<!-- config boot & cloud -->
<spring-boot.version>2.7.7</spring-boot.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
I'm blocked on a http error 502 (proxy error) you will find the logs below.
When my http call exceeds 5 minutes my gateway return 502 to my Angular client - and the the back-end continue the treatment there is no error on back-end -
Gecko/20100101 Firefox/102.0" "172.17.10.67:46630" "172.17.0.79:61077"
x_forwarded_for:"10.195.209.56, 172.17.0.78, 172.17.10.67"
x_forwarded_proto:"https,https" vcap_request_id:"ff220ed6-266d-435d-5871-58f67d80c1d9"
response_time:300.005213 gorouter_time:0.000213 app_id:"4aa32d01-bbbe-4876-bed8-6256524bbd2e"
app_index:"0" instance_id:"cbe8ded1-e8d4-4a5f-7ab0-f75b" x_cf_routererror:"endpoint_failure (context canceled)"
x_b3_traceid:"4184c84b0c60d6a03fc900b8969f3e97" x_b3_spanid:"3fc900b8969f3e97" x_b3_parentspanid:"-"
b3:"4184c84b0c60d6a03fc900b8969f3e97-3fc900b8969f3e97"
I tried this configuration but it not resolve the error timeout
(this configuration resolve the timeout error http 504 and not 502)
spring:
cloud:
gateway:
httpclient:
connect-timeout: 60000
response-timeout: 600s
I tried the configuration by route also it gives no result.

Spring MVC redirect is rewritten from localhost to value in Host-Header

I have an application (spring boot 2.5.6) where the user is able to request a REST resource with a callback uri as query parameter eg. https://someservice/callback or http://localhost:5555/callback. This works well if a user specifies a port which is not equal to the internal tomcat port (8080 in this case). However if the user defines an uri like http://localhost:8080 he's not redirected to http://localhost:8080/callback but to the uri which was specified in the request Host-Header eg. https://myservice.com/callback:
Working as expected
GET https://myservice.com/foobar?callback=https://someotherservice/callback HTTP/1.1
Host: myservice.com
...
HTTP/1.1 303
Location: https://someotherservice/callback?...
...
Working as expected
GET https://myservice.com/foobar?callback=http://localhost:5555/callback HTTP/1.1
Host: myservice.com
...
HTTP/1.1 303
Location: http://localhost:5555/callback?...
...
Not working as expected
GET https://myservice.com/foobar?callback=http://localhost:8080/callback HTTP/1.1
Host: myservice.com
...
HTTP/1.1 303
Location: https://myservice.com/callback?...
...
I'm not able to reproduce this behavior on my local machine (windows 10). This happens on our dev environment (debian buster). Any ideas who is rewriting the url (spring, tomcat?) and how I'm able to prevent this behavior? I tested it on a single instance to be sure it's not our loadbalancer.
Thank you in advance!

Spring cloud client trying to run on server port 8888

The config server is up and the client is able to fetch the properties from config server.
HTTP GET http://localhost:8888/account-service/dev/config
Accept=[application/json, application/*+json]
Response 200 OK
But the problem is, client service is trying to start on config server port 8888. I have set server.port=8080 in the client but still not working.
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8888 was already in use.
Am I missing any configuration here? Highly appreciate any help.
Config server application.properties,
spring.application.name=config-server
spring.cloud.config.profiles=dev
spring.cloud.config.server.git.uri=REPO_URL
server.port=8888
Finally, I was able to find the solution. When I was trying to start client service, server.port was also getting overridden with config server port. I added server.port=8080 in the properties file for the client service profile in config repo (account-service.properties) and it worked.

Zuul Forwarding error - Internal Server error 500

This is what I am trying to achieve but getting Zuul forwarding error.
Zuul GitHub
UserRegistration Microservice - which will call another Microservice. Also, it has some other APIs'. GitHub Link
UserSearchDelete: above UserRegistration microservice will call this service. GitHub Link
Eureka Server: GitHub Link
If I run the services in Springboot STS at localhost then eveything is working fine.
But if I dockarise all the services and run different containers then I am getting Zuul forrwarding error.
Refer the application.yml files in the Github repos. All the services are getting registered with Eureka.
Could please help? Is it a bug or I am doing something wrong?
GitHub issue reference: https://github.com/spring-cloud/spring-cloud-netflix/issues/3408
Getting the below errors:
"cause": {
"cause": null,
"stackTrace": [
{....
"nStatusCode": 500,
"errorCause": "GENERAL",
"message": "Forwarding error",
"localizedMessage": "Forwarding error",
"suppressed": []
}```
Verify that your Zuul paths are setup properly.
If running on a Docker network, each docker deployment must be connected to the same docker network using the --net myCommonNet tag in the run command. Note that you will have to create this network first. Then you can reference the container hosts on their names.
If you are using kubernetes as your deployment environment, you can access the different microservices using the service name. Then you configure your Zuul's properties.yml as:
zuul:
routes:
myService:
path: /myService/**
url: http://myService.default.svc.cluster.local:8086

How can I configure yeoman (gruntjs) to run as HTTPS?

I have recently been working with Yeoman (http://yeoman.io/) and now would like to set up my local environment to handle HTTPS requests, so that I can have it handle callbacks from OAUTH providers.
Under a non-Yeoman/grunt setup I was able to get node.js configured to handle HTTPS in a following a similar path as directed in this question (How to create an HTTPS server in Node.js?).
Looking at the gruntJS repo on github it appears this has been added as a feature (https://github.com/gruntjs/grunt-contrib-connect/pull/15) but I still am unclear as to where I set the appropriate options.
grunt.initConfig({
connect: {
server: {
options: {
protocol: 'https',
port: 8443,
key: grunt.file.read('server.key').toString(),
cert: grunt.file.read('server.crt').toString(),
ca: grunt.file.read('ca.crt').toString(),
passphrase: 'grunt'
}
}
}
});
see this commit

Resources