Need help to add url path as an endpoint point for minio - minio

I have deployed standalone Minio in a server. I also have my backend running in it. So the enpoints would be something like this:
Minio URL: https://example.com/minio
Backend URL: https://example.com/api
When I tried to setup Minio configuration in my node project, I get error. Can you help me in setting this up?
Here is my code:
let client = new Minio.Client({
endPoint: 'example.com/minio',
useSSL: true,
accessKey: 'xxxxx',
secretKey: 'xxxxx'
})

There are two ways we can do this:
Add a subdomain like minio.example.com in the endpoint
We can configure a particular port in MINIO_OPTS and we can redirect to the port when we have "/minio"

Related

Using SpringBoot, NodeJS and Vue-CLI - not saved session

I have been using SpringBoot for web development before, which needs to manage session, database, HTML and other functions.
Recently, I am going to use VUE, replacing the HTML part of SpringBoot.
Now I use the following two methods for development, but I am troubled by problems such as cross domain and session cannot be keeped.
Use nodejs as the enter of the website and use vue.config to configure the agent. In this way, the URL located is correct, but the login status cannot be saved.For example, if submit a form for login, the background returns to the successful message for login, but if refresh the page, it will show 'not login'. The 'devServer' configuration is as follows
devServer: {
open: false,
host: 'localhost',
port: 8080,
proxy: {
'/ API: {
Target: 'http://192.168.9.211/',
ChangeOrigin: true,
ws: true,
PathRewrite: {
'^ / API' : ' '
},
cookieDomainRewrite: 'localhost',
}
}
}
Use Nginx as gateway, and then forward the HTML request to NodeJS, and the data request (such as JSON data) to SpringBoot.I haven't had time to experiment with this idea, because it may still occur session saving issues.Nginx is forwarding HTTP requests to Nodejs and SpringBoot, so this saved session is from Nodejs or SpringBoot?
So ask if anyone has done a similar project and if you can share your experience.

nestjs + socket.io serving websockets from microservice at nested path instead of the root of the host always returns 404 Not Found

I'm using the socket.io implementation with nestjs. My overall in-production architecture is relying on a load balancer to route requests on paths to microservice containers.
One of them contains a websocket that interacts with user data and is nested on mydomain.com/apis/user
On my gateway I've configured it to use this path:
#WebSocketGateway({ path: "/apis/user/gateway", namespace: "/apis/user/gateway" })
and I've tried variations without the namespace there and with just the path.
I also have a global prefix: app.setGlobalPrefix("apis/user"); removing this makes no difference, it seems I need to define the path to the gateway either way prefix or not.
Then on the client I'm trying to just connect to it via either adding the path in the url, or to the options object, as such:
const endpoint = "https://example.com/apis/user/gateway";
socket = io(endpoint, {
secure: true,
path: "/apis/user/gateway",
});
This works for the path and handleConnection triggers on the gateway nested there, however configuring polling on the backend does not work, the client still throws:
https://example.com/apis/user/gateway/?EIO=4&transport=polling&t=NXVpMfB 404 Not Found
I had the same problem, all the various options are confusing. I got it sorted though, here is what worked:
For the nestjs:
#WebSocketGateway({
cors: {
origin: '*',
},
namespace: '/api/v1/ws',
path: '/api/v1/ws/socket.io',
})
For socket.io:
const newSocket = io("http://localhost:3000/api/v1/ws", {
path: "/api/v1/ws/socket.io",
});

Nuxt serverInit axios on localhost getting ENOTFOUND

I'm making a website using NuxtJS for the front-end, and Laravel for the backend.
I need to have some data available on every page, so I fetch it using the nuxtServerInit function like so:
async nuxtServerInit({ commit }, { $axios }) {
const items= await $axios.$get('items')
commit('saveItems', items)
}
This works fine when pointing to my Laravel app that's already online, but not when I'm running it on my local machine. I get an "get addrinfo ENOTFOUND 3213" error.
My .env file contains the baseURL for axios, so local would be:
API_URL=http://127.0.0.1:8000/v1/
I tried many things but to no avail. It works when using the live backend, and there's no problem with the API_URL as it works on every other function/page apart from the nuxtServerInit one. I tried:
Using nuxt/dotenv as well as their new runtimeConfig settings to configure Axios' base URL in nuxt.config.js
Changing the port on which my backend runs
Changing the port on which my frontend runs
Adding a custom URl for my local backend (like devlocal.com pointing to localhost:8000)
But nothing works. My /etc/host file also correctly contains 127.0.0.1 as I saw it was a solution for a lot of ENOTFOUND errors on local.
I also tried changing the API_URL in my .env file to
API_URL=localhost:8000/v1/
But then I get "ENOTFOUND 8000" instead, or whichever the port I set my Laravel server to.
Please help!
Edit:
After toggling debug on Axios on dev, I found the host name is wrong in the request, which in turns make the URL incorrect:
reusedSocket: false,
host: '3213',
protocol: 'http:',
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'http://3213/http://localhost:8000/v1/items',
I don't know where the "3213" comes from. I tried setting default host/hostnames/port values to Axios in nuxt.config.js, but no luck.
Solved it randomly. I had a proxy variable setup in my environment variables (Win 10) called "http_proxy". Deleted it, and no more problem.

How to change websocket url in graphql-playground (subscriptions)

I wanted to change the graphql websocket end point inside graphql, anyone know how to do this?
by default it pings
wss://localhost/graphql
I need to change it to pusher url
thanks :-)
If you are running a standalone instance of GraphQL Playground, the URL is passed directly to the component as a prop:
<Playground
endpoint="http://localhost/graphql"
subscriptionEndpoint="wss://localhost/graphql"
/>
If you're using apollo-server, the endpoint URL should be derived from the subscriptionsPath, but it can also be set directly in the config:
const server = new ApolloServer({
typeDefs,
resolvers,
playground: {
subscriptionEndpoint: 'wss://localhost/graphql',
},
});
EDIT:
It doesn't appear there's a way to configure the desktop client with a specific subscription URL, unless you're using it with a local repo that contains a .graphqlconfig. In that case, you can provide additional information about your environment, including the subscription url, in the config file as outlined here.

Whitelabel Error Page This application has no explicit mapping for /error time out

I am completely new to zuul, but I am facing a challenge I can't seem to overcome due to some changes we made in the configuration.
Zuul is being used simply to re-write some urls in this case, nothing more. It works fine in all sorts of other environments and used to work in this one until we made these changes.
The zuul config looks something like this..
spring:
profiles: development
zuul:
routes:
fakebank:
path: /fake-bank/rest/projects/fakebank/**
url: https://dev-fakebank-api.fkebnk.com/office-365/rest
fakebank2:
path: /rest/projects/fakebank/**
url: https://dev-fakebank-api.fkebnk.com/office-365/res
However, when I visit the URL that is to be re-written, for example https://dev-api.fakebank.com/fake-bank/rest/projects/fake-bank/health-check, I just keep getting the following error:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jun 23 17:48:24 UTC 2016
There was an unexpected error (type=Internal Server Error, status=500).
connect timed out
Does anyone have any idea or can point me in a good direction to start walking?
Thanks in advance.
I managed to solve this on my own and figured I would post the answer out here for others to consume.
In the end, there was an error in the re-write configuration. Sort of.
I noticed there was no SSL configuration to speak of for the tomcat server. So changing the https to http solved the problem. I would imagine that if I were to setup SSL on the tomcat instance that it may start working. If I wanted to use SSL, I would have alter the URL again to include port 443 as shown in the example below.
Example :
spring:
profiles: development
zuul:
routes:
fakebank: path: /fake-bank/rest/projects/fakebank/**
- url: https:// dev-fakebank-api.fkebnk.com/office-365/rest
(Non-SSL)
+ url: http:// dev-fakebank-api.fkebnk.com/office-365/rest
Or (if I setup SSL)
+ url: https:// dev-fakebank-api.fkebnk.com:443/office-365/rest
fakebank2: path: /rest/projects/fakebank/**
- url: https:// dev-fakebank-api.fkebnk.com/office-365/res
(Non-SSL)
+ url: http:// dev-fakebank-api.fkebnk.com/office-365/res
Or (if I setup SSL)
+ url: https:// dev-fakebank-api.fkebnk.com:443/office-365/res
Hope this helps someone else that finds themselves in this situation.
Thanks,

Resources