Redirect HTTP/POST request

#1

Hello!

I’m trying to get the hang of Crossbar. I have a setup to serve static web content and redirect a path to another (dynamic) webserver port:
{
“controller”: {},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “anonymous”,
“permissions”: [
{
“uri”: “*”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “web”,
“endpoint”: {
“type”: “tcp”,
“port”: 4000
},
“paths”: {
“/”: {
“type”: “static”,
“directory”: “…/served”,
“options”: {
“cache_timeout”: 1
}
},
“ws”: {
“type”: “websocket”
},
“graphql”: {
“type”: “redirect”,
“url”: “http://localhost:8080
}
}
}
]
}
]
}

``

This does not work because crossbar only accepts GET requests and GraphQL sends POST requests. I got “HTTP/1.1 405 Method Not Allowed” errors.

In short I would like that http://localhost:4000/graphql requests got proxied to http://localhost:8080. How can I do that with Crossbar?

Thanks,

0 Likes

#2

I have just noticed this has been an issue on github (https://github.com/crossbario/crossbar/issues/390). Since it has been closed for 0.12 I thought to pull the source and look for it, but I couldn’t find anything related to being able to reverse-proxy. Am I missing something?

···

On Sunday, October 4, 2015 at 6:35:07 PM UTC+2, Nándor Mátravölgyi wrote:

Hello!

I’m trying to get the hang of Crossbar. I have a setup to serve static web content and redirect a path to another (dynamic) webserver port:
{
“controller”: {},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “anonymous”,
“permissions”: [
{
“uri”: “*”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “web”,
“endpoint”: {
“type”: “tcp”,
“port”: 4000
},
“paths”: {
“/”: {
“type”: “static”,
“directory”: “…/served”,
“options”: {
“cache_timeout”: 1
}
},
“ws”: {
“type”: “websocket”
},
“graphql”: {
“type”: “redirect”,
“url”: “http://localhost:8080
}
}
}
]
}
]
}

``

This does not work because crossbar only accepts GET requests and GraphQL sends POST requests. I got “HTTP/1.1 405 Method Not Allowed” errors.

In short I would like that http://localhost:4000/graphql requests got proxied to http://localhost:8080. How can I do that with Crossbar?

Thanks,

0 Likes

#3

Hi!

The issue you reference was closed as a duplicate for https://github.com/crossbario/crossbar/issues/334. We’re currently working on the 0.11.x releases, so 0.12 which it’s been assigned to is yet to come.

Regards,

Alex

···

Am Dienstag, 6. Oktober 2015 13:25:25 UTC+2 schrieb Nándor Mátravölgyi:

Hello!

I’m trying to get the hang of Crossbar. I have a setup to serve static web content and redirect a path to another (dynamic) webserver port:
{
“controller”: {},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “anonymous”,
“permissions”: [
{
“uri”: “*”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “web”,
“endpoint”: {
“type”: “tcp”,
“port”: 4000
},
“paths”: {
“/”: {
“type”: “static”,
“directory”: “…/served”,
“options”: {
“cache_timeout”: 1
}
},
“ws”: {
“type”: “websocket”
},
“graphql”: {
“type”: “redirect”,
“url”: “http://localhost:8080
}
}
}
]
}
]
}

``

This does not work because crossbar only accepts GET requests and GraphQL sends POST requests. I got “HTTP/1.1 405 Method Not Allowed” errors.

In short I would like that http://localhost:4000/graphql requests got proxied to http://localhost:8080. How can I do that with Crossbar?

Thanks,

I have just noticed this has been an issue on github (https://github.com/crossbario/crossbar/issues/390). Since it has been closed for 0.12 I thought to pull the source and look for it, but I couldn’t find anything related to being able to reverse-proxy. Am I missing something?

On Sunday, October 4, 2015 at 6:35:07 PM UTC+2, Nándor Mátravölgyi wrote:

0 Likes

#4

Oh, alright. Thanks for clearing that up for me. I’ll use nginx until then.

Regards,

···

On Wednesday, October 7, 2015 at 12:36:27 PM UTC+2, Alexander Gödde wrote:

Hi!

The issue you reference was closed as a duplicate for https://github.com/crossbario/crossbar/issues/334. We’re currently working on the 0.11.x releases, so 0.12 which it’s been assigned to is yet to come.

Regards,

Alex

Am Dienstag, 6. Oktober 2015 13:25:25 UTC+2 schrieb Nándor Mátravölgyi:

Hello!

I’m trying to get the hang of Crossbar. I have a setup to serve static web content and redirect a path to another (dynamic) webserver port:
{
“controller”: {},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “anonymous”,
“permissions”: [
{
“uri”: “*”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “web”,
“endpoint”: {
“type”: “tcp”,
“port”: 4000
},
“paths”: {
“/”: {
“type”: “static”,
“directory”: “…/served”,
“options”: {
“cache_timeout”: 1
}
},
“ws”: {
“type”: “websocket”
},
“graphql”: {
“type”: “redirect”,
“url”: “http://localhost:8080
}
}
}
]
}
]
}

``

This does not work because crossbar only accepts GET requests and GraphQL sends POST requests. I got “HTTP/1.1 405 Method Not Allowed” errors.

In short I would like that http://localhost:4000/graphql requests got proxied to http://localhost:8080. How can I do that with Crossbar?

Thanks,

I have just noticed this has been an issue on github (https://github.com/crossbario/crossbar/issues/390). Since it has been closed for 0.12 I thought to pull the source and look for it, but I couldn’t find anything related to being able to reverse-proxy. Am I missing something?

On Sunday, October 4, 2015 at 6:35:07 PM UTC+2, Nándor Mátravölgyi wrote:

0 Likes