Skip to content

Comments

Moonraker route_prefix support#10

Open
wilmardo wants to merge 3 commits intocmroche:mainfrom
wilmardo:route_prefix_support
Open

Moonraker route_prefix support#10
wilmardo wants to merge 3 commits intocmroche:mainfrom
wilmardo:route_prefix_support

Conversation

@wilmardo
Copy link

As seen in the docs it is possible to configure Moonraker on a subpath:

route_prefix:
#   A prefix prepended to the path for each HTTP endpoint.  For example
#   if the route_prefix is set to moonraker/printer1, then the server info
#   endpoint is available at:
#     http://myprinter.local/moonraker/printer1/server/info
#
#   This is primarily useful for installations that feature multiple instances
#   of Moonraker, as it allows a reverse proxy identify the correct instance based
#   on the path and redirect requests without a rewrite.  Note that frontends must feature
#   support for HTTP endpoints with a route prefix to communicate with Moonraker when
#   this option is set. The default is no route prefix.

https://moonraker.readthedocs.io/en/latest/configuration/

Tested locally with the moonraker.py (also committed the extra arguments I needed to test) see below:

# python ./moonraker.py --host example.com --port 443 --route-prefix moonraker --ssl
moonraker_api.websockets.websocketclient - DEBUG - Websocket changing to state ws_connecting
__main__ - DEBUG - Handling state_changed event to ws_connecting
moonraker_api.websockets.websocketclient - DEBUG - Websocket changing to state ws_connected
__main__ - DEBUG - Handling state_changed event to ws_connected
moonraker_api.websockets.websocketclient - DEBUG - Sending message {"jsonrpc": "2.0", "method": "printer.info", "id": 127157}
moonraker_api.websockets.websocketclient - DEBUG - Received message: WSMessage(type=<WSMsgType.TEXT: 1>, data='{"jsonrpc":"2.0","result":{"state":"shutdown","state_message":"Lost communication with MCU \'mcu\'\\nOnce the underlying issue is corrected, use the\\n\\"FIRMWARE_RESTART\\" command to reset the firmware, reload the\\nconfig, and restart the host software.\\nPrinter is shutdown\\n","hostname":"ender3","klipper_path":"/home/klipper/klipper","python_path":"/home/klipper/klippy-env/bin/python","process_id":65020,"user_id":1000,"group_id":1000,"log_file":"/home/klipper/printer_data/logs/klippy.log","config_file":"/home/klipper/printer_data/config/printer.cfg","software_version":"v0.13.0-375-gba79d72f","cpu_info":"4 core ?"},"id":127157}', extra='')

Signed-off-by: wilmarguida <w.denouden@guida.nl>
Signed-off-by: wilmarguida <w.denouden@guida.nl>
Signed-off-by: wilmarguida <w.denouden@guida.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant