knightlock_
knightlock_
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
okay ya for sure! I'll try this and get back to you. Thanks for your help!
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
oop, holdup, I may have sent you the wrong caddy file -->
# global options
{
admin off # theres no need for the admin api in railway's environment
persist_config off # storage isn't persistent anyway
auto_https off # railway handles https for us, this would cause issues if left enabled
# runtime logs
log {
format json # set runtime log format to json mode
}
# server options
servers {
trusted_proxies static private_ranges # trust railway's proxy
}
}

# site block, listens on the $PORT environment variable, automatically assigned by railway
:{$PORT} {
# access logs
log {
format json # set access log format to json mode
}

reverse_proxy {$FRONTEND_HOST} # proxy all requests for /* to the frontend, configure this variable in the service settings

# the handle_path directive will strip /api/ from the path before proxying
# this is needed if your backend's api routes don't start with /api/
# change paths as needed
#handle_path /api/* {
# this strips the /api/ prefix from the uri sent to the proxy address
# reverse_proxy {$BACKEND_HOST} # proxy all requests for /api/* to the backend, configure this variable in the service settings
#}

# if your backend's api routes do start with /api/ then you wouldn't want to strip the path prefix
# if so, comment out the above handle_path block, and uncomment this reverse_proxy directive
# change paths as needed
reverse_proxy /api/* {$BACKEND_HOST} # configure this variable in the service settings
}
# global options
{
admin off # theres no need for the admin api in railway's environment
persist_config off # storage isn't persistent anyway
auto_https off # railway handles https for us, this would cause issues if left enabled
# runtime logs
log {
format json # set runtime log format to json mode
}
# server options
servers {
trusted_proxies static private_ranges # trust railway's proxy
}
}

# site block, listens on the $PORT environment variable, automatically assigned by railway
:{$PORT} {
# access logs
log {
format json # set access log format to json mode
}

reverse_proxy {$FRONTEND_HOST} # proxy all requests for /* to the frontend, configure this variable in the service settings

# the handle_path directive will strip /api/ from the path before proxying
# this is needed if your backend's api routes don't start with /api/
# change paths as needed
#handle_path /api/* {
# this strips the /api/ prefix from the uri sent to the proxy address
# reverse_proxy {$BACKEND_HOST} # proxy all requests for /api/* to the backend, configure this variable in the service settings
#}

# if your backend's api routes do start with /api/ then you wouldn't want to strip the path prefix
# if so, comment out the above handle_path block, and uncomment this reverse_proxy directive
# change paths as needed
reverse_proxy /api/* {$BACKEND_HOST} # configure this variable in the service settings
}
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
honestly cant say for sure, Id have to ask my co worker but is there an alternative you think instead? By removing the caddy proxy, you think it should clear the air?
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
well, it looks like all we're doing here is connecting our front and back end under one domain
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
No description
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
ooo nice! Thanks for writing it! We were just experimenting, my co worker and I and we came on some examples, so far its working as it should, but you think its overkill? Maybe messing with the domain?
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
ya for sure,
{ # global options
admin off # theres no need for the admin api in railway's environment
persist_config off # storage isn't persistent anyway
auto_https off # railway handles https for us, this would cause issues if left enabled
log { # runtime logs
format console # set runtime log format to console mode
}
servers { # server options
trusted_proxies static private_ranges # trust railway's proxy
}
}

:{$PORT} { # site block, listens on the $PORT environment variable, automatically assigned by railway
log { # access logs
format console # set access log format to console mode
}

# health check for railway
respond /health 200

# serve from the 'build' folder
root * build

# enable gzipping responses
encode gzip

# serve files from 'build'
file_server

# if path doesn't exist, redirect it to 'index.html' for client side routing
try_files {path} /index.html
}
{ # global options
admin off # theres no need for the admin api in railway's environment
persist_config off # storage isn't persistent anyway
auto_https off # railway handles https for us, this would cause issues if left enabled
log { # runtime logs
format console # set runtime log format to console mode
}
servers { # server options
trusted_proxies static private_ranges # trust railway's proxy
}
}

:{$PORT} { # site block, listens on the $PORT environment variable, automatically assigned by railway
log { # access logs
format console # set access log format to console mode
}

# health check for railway
respond /health 200

# serve from the 'build' folder
root * build

# enable gzipping responses
encode gzip

# serve files from 'build'
file_server

# if path doesn't exist, redirect it to 'index.html' for client side routing
try_files {path} /index.html
}
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
nope, just trying to connect
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
hmm maybe its the library Im using? Im not exaclty sure, using sock-js-client
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
hmmm, Im getting the error
main.js:73 Uncaught
SyntaxError: The URL's scheme must be either 'http:' or 'https:'. 'wss:' is not allowed.
main.js:73 Uncaught
SyntaxError: The URL's scheme must be either 'http:' or 'https:'. 'wss:' is not allowed.
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
I believe we were using caddy to generate a public domain
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
sorry, ya no worries --> https://assignments-dev.coderscampus.com/ws/021/bntqbx12/xhr_streaming?t=1721787651124 Request Method: POST Status Code: 405 Method Not Allowed Remote Address: 34.86.119.124:443 Referrer Policy: strict-origin-when-cross-origin
35 replies
RRailway
Created by knightlock_ on 7/24/2024 in #✋|help
Connecting a Websocket over a Caddy Proxy returns 405 Method Not Allowed with a POST call
e48131f7-096a-4b0a-8733-ecc43f93da7b
35 replies