Commit Graph

51 Commits

Author SHA1 Message Date
Boris Bera a4dcd007e4 Pass debug log level to http-proxy-middleware
Signed-off-by: Boris Bera <bbera@coveo.com>
2023-03-07 12:04:57 -05:00
Boris Bera 4acd93dae1 Pass logLevel to http-proxy-middleware
Under the hood, `http-proxy-middleware` checks its log level to see if
it should log requests. Passing in the log level ensures that we see
those messages when we run with `LOG_LEVEL=debug`.

Signed-off-by: Boris Bera <bbera@coveo.com>
2023-03-01 12:38:46 -05:00
Dan Hoizner 3e3eea4bc7 feat(proxy-backend): configure request body revival for all targets
Signed-off-by: Dan Hoizner <dan.hoizner@gmail.com>
2023-02-14 16:21:26 -05:00
Dan Hoizner a30d2e8df5 feat(plugin-proxy-backend): revive request bodies
in order to support proxying requests with bodies that have previously
been consumed in a middleware, the proxy config can now specify
`reviveRequestBody: true` in order to propagate the previously consumed
body to the proxied request.

Signed-off-by: Dan Hoizner <dan.hoizner@gmail.com>
2023-02-08 15:34:20 -05:00
Patrik Oldsberg 0ff03319be backend-plugin-api: switch createBackendPlugin id -> pluginId
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2023-02-06 17:49:57 +01:00
Fredrik Adelöw 4a6f38a535 implement some of the trivial backend plugins
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2023-02-01 11:36:55 +01:00
Juan Pablo Garcia Ripa fcf5d4f4ba add @config annotation to docs
Signed-off-by: Juan Pablo Garcia Ripa <juanpablog@spotify.com>
2022-11-23 13:49:56 +01:00
Fredrik Adelöw aaab1e34da Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2022-08-30 13:44:09 +02:00
Fredrik Adelöw f6be17460d well, let's clean up some more
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2022-08-18 15:45:15 +02:00
Crevil dd48ca1bba Replace router instead of modifying it
Signed-off-by: Crevil <bjoern.soerensen@gmail.com>
2022-07-08 21:05:50 +02:00
Crevil a4fa1ce090 Add config hot reloading to proxy-backend
When working with the proxy configuration or plugins facilitating the proxy
package the workflow is currently somewhat cumbersom as changes to the proxy
configuration requires a full restart of the backend server.

Use cases where the proxy configuration is updated is when testing out new
routes for plugins to use and updating header configuration like authorization
tokens.

This change updates the proxy-backend to subscribe to configuration changes and
update the router when changes to the proxy is made.

Signed-off-by: Crevil <bjoern.soerensen@gmail.com>
2022-07-02 09:24:33 +02:00
Brian Fletcher 27e1ab0ec4 addressing review suggestions
Signed-off-by: Brian Fletcher <brian@roadie.io>
2022-01-28 13:52:03 +00:00
Brian Fletcher 8030dc7dd5 only skip proxies if configured to do so
Signed-off-by: Brian Fletcher <brian@roadie.io>
2022-01-28 11:28:46 +00:00
Brian Fletcher 124520078c allow backend to start if proxy target is not set
Signed-off-by: Brian Fletcher <brian@roadie.io>
2022-01-28 09:50:27 +00:00
Otto Sichert b23bc7f9c3 Change default port of backend to 7007 due to MacOS Control Center update
Signed-off-by: Otto Sichert <git@ottosichert.de>
2021-11-18 16:45:57 +01:00
Fredrik Adelöw 6160f89865 fake the test config to get rid of the timeouts
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2021-11-09 10:10:13 +01:00
Patrik Oldsberg 8142a8ecb2 packages,plugins: add package documentation
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2021-09-14 18:47:53 +02:00
Patrik Oldsberg 13da7be3c1 proxy-backend: cleaner and more informative log messages
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2021-06-24 11:22:26 +02:00
Fredrik Adelöw a88073c29a Update copyright headers
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2021-06-18 20:26:42 +02:00
Fredrik Adelöw c5204c01ba Merge pull request #6032 from backstage/freben/backend-dev
Make `yarn dev` for backend plugins respect the `PLUGIN_PORT` env var
2021-06-15 15:12:17 +02:00
Fredrik Adelöw 3108ff7bfd Make yarn dev for backends respect the PLUGIN_PORT env var
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2021-06-14 14:46:19 +02:00
Fredrik Adelöw 6ffcf9ed85 fixup
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
2021-06-08 15:04:30 +02:00
Tim Hansen 875809a59b Fix proxy redirect for base path without slash
Signed-off-by: Tim Hansen <timbonicus@gmail.com>
2021-06-04 21:18:10 -06:00
Brian Fox cdb3426e56 fix(proxy-backend): prefix routes with / if not present in config
This commit ensures that the default `pathRewrite` configuration for a proxy element is more resilient to the combination of whether:
- `route` is prefixed with `/`
- `pathPrefix` on the plugin is suffixed with `/` (which at present it will never be - see comments).

Signed-off-by: Brian Fox <brianhfox@gmail.com>
2021-04-27 12:40:15 +02:00
Brian Fox 6c38f5e920 tests(proxy-backend): align tests with default backend configuration
The pathPrefix is not suffixed with `/` by default as noted at https://github.com/backstage/backstage/blob/df897a6126d1641d111b015c527cc8d40c47bd06/packages/backend-common/src/discovery/types.ts#L47 and seen in the implementation at  https://github.com/backstage/backstage/blob/df897a6126d1641d111b015c527cc8d40c47bd06/packages/backend-common/src/discovery/SingleHostDiscovery.ts#L81.

Currently the tests work in the opposite way - the pathPrefix is suffixed by / whereas the routes are **not** prefixed by /.

This commit brings the tests in line with the default configuration prior to any further work.

Signed-off-by: Brian Fox <brianhfox@gmail.com>
2021-04-27 12:40:15 +02:00
Patrik Oldsberg 0e068db972 run prettier
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2021-03-07 23:37:48 +01:00
Patrik Oldsberg d77c3ed1aa Merge pull request #4740 from Liverpool-Victoria/bug/plugin-backend-proxy-with-agent
Fix for proxy-backend plugin when global-agent is enabled
2021-03-02 12:49:48 +01:00
Nir Gazit 1987c93416 Added a verification for URLs in proxy backend 2021-03-02 10:34:02 +02:00
bobalong79 1fc9627a1b Update tests after moving header processing from onProxyReq to filter 2021-03-01 18:18:10 +00:00
bobalong79 316b7bff61 Add rationale explaining why we do the header modifications in the filter 2021-03-01 18:01:44 +00:00
bobalong79 9ce68b677b Fix for proxy-backend plugin when global-agent is enabled 2021-03-01 11:30:44 +00:00
Andrew Thauer 28adfd3c4c fix: test failures & warnings 2021-02-24 10:12:49 -05:00
Dominik Henneke 6a6c7c14ea Filter the response headers in the proxy backend 2020-11-30 15:18:29 +01:00
Patrik Oldsberg bc9f536545 Merge pull request #2994 from spotify/rugvip/conflagrate
config-loader: switch to using --config options to load in config
2020-10-22 18:01:21 +02:00
Patrik Oldsberg 8c2b76e45f config-loader: switch to using --config options to load in config 2020-10-22 10:52:06 +02:00
blam 681c861d25 Merge remote-tracking branch 'origin' into migrate-to-msw
* origin:
  fix: ts
  fix: forwardRef to SidebarItem
  fix(cli): one more await in the test
  backend-common: make loadBackendConfig return config directly and log all resolved app-configs
2020-10-21 13:57:40 +02:00
Patrik Oldsberg 7bbeb049fe backend-common: make loadBackendConfig return config directly and log all resolved app-configs 2020-10-20 00:10:28 +02:00
blam b33353dd39 Merge branch 'master' of github.com:spotify/backstage into migrate-to-msw
* 'master' of github.com:spotify/backstage: (110 commits)
  chore(catalog-backend): removing redudant classes and some functions
  chore(deps-dev): bump @types/webpack from 4.41.21 to 4.41.22 (#2765)
  move codecov.yml to .github
  feat(catalog-backend): add batch concurrency
  create-app: remove build step
  cli: simplify jest transform ignore regex
  feat(catalog-backend): introduce batching, speed up reading and writing of large datasets
  Techdocs: add Azure DevOps prepare support (#2748)
  feat(techdocs-header): Show breadcrumbs on docs page (#2786)
  changesets: add entry for create-app template location fix
  create-app: revert to github location type for example templates
  fix: make catalog filter work again
  Use new url scheme for techdocs
  feat: remove LocationProcessor.processEntity
  Add Dockerfile for helm chart
  feat: use the new UrlReader in the CodeOwnersProcessor
  feat: use new UrlReader in PlaceholderProcessor
  feat: remove the backstage.io/definition-at-location annotation
  Update loud-lamps-visit.md
  feat(proxy-backend): limit the forwarded http headers to a safe set
  ...
2020-10-09 14:48:32 +02:00
blam 97e0b6df35 chore: removing more occurences of jest-fetch-mock and node-fetch 2020-10-09 13:34:08 +02:00
Dominik Henneke 9226c2aaa0 feat(proxy-backend): limit the forwarded http headers to a safe set 2020-10-08 14:30:56 +02:00
Patrik Oldsberg 0e76ab7873 backend: add and use for external URL discovery 2020-09-25 10:50:32 +02:00
Dominik Henneke 7553827223 feat(proxy-backend): support limiting the proxied HTTP methods 2020-09-11 13:56:41 +02:00
Marcus Eide 7d8058a1ef Make http-proxy-middleware log to supplied logger 2020-09-02 11:08:40 +02:00
Fredrik Adelöw 6d774764cd feat(proxy-backend): more proxy config tweaks and docs 2020-08-28 14:36:13 +02:00
Rogerio Angeliski f73dc889cb fix: update the winston logger to use namespace
fix #1874
2020-08-08 15:58:06 -03:00
Patrik Oldsberg 62222b543c config-loader,backend-common: refactor config loading to pass in path and use common util for backend 2020-08-03 21:24:44 +02:00
Ivan Shmidt 0fdadd18e3 fix(proxy): working circleci example 2020-07-19 20:21:17 +02:00
Ivan Shmidt ac27ab635b fix(proxy): versions, private 2020-07-13 11:21:43 +02:00
Ivan Shmidt 4a990863fd fix(proxy): add test 2020-07-10 00:56:40 +02:00
Ivan Shmidt ed0bd8f616 fix(proxy): types and versions 2020-07-09 02:10:33 +02:00