Use APISix as Reverse Proxy #12137
-
How can I enable APISIX to work with a ReverseProxy? I am using relative paths in HTML, for assets like JS and CSS Example:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @felipemesturini! I'm Dosu, your friendly bot here to help you tackle bugs, answer questions, and guide you in becoming a contributor. I'm looking forward to assisting you while we wait for a human maintainer. To configure APISIX as a reverse proxy similar to your Apache setup, you can use the
Here's an example configuration for APISIX: {
"uri": "/docs/*",
"plugins": {
"proxy-rewrite": {
"uri": "/swagger/$1",
"host": "pix.docs.internal"
}
},
"upstream": {
"nodes": {
"pix.docs.internal:8001": 1
},
"type": "roundrobin"
}
}
This setup should help you use APISIX as a reverse proxy while handling relative paths for static assets like JS and CSS. If you encounter issues with relative paths, consider ensuring that your application generates absolute paths or uses a base tag in HTML to resolve them correctly. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
Hello @felipemesturini! I'm Dosu, your friendly bot here to help you tackle bugs, answer questions, and guide you in becoming a contributor. I'm looking forward to assisting you while we wait for a human maintainer.
To configure APISIX as a reverse proxy similar to your Apache setup, you can use the
proxy-rewrite
plugin to handle URI rewriting and host preservation. Here's how you can achieve this:Proxy URI Rewriting: Use the
proxy-rewrite
plugin to rewrite the URI path. This is similar to theProxyPass
andProxyPassReverse
directives in Apache.Preserve Host Header: To preserve the host header, similar to
ProxyPreserveHost On
, ensure that theHost
header is set correctly in the req…