Score:0

Apache ProxyPass only proxying URL, but not page assets

lc flag

So I currently have a proxy configuration that looks like the following:

ProxyPassMatch ^/foo/bar/(.+)$ https://xyz.domain.net/$1
ProxyPassReverse ^/foo/bar/(.+)$ https://xyz.domain.net/$1

ProxyPreserveHost Off

I'm trying to map, for example, https://my.website.com/foo/bar/home to https://xyz.domain.net/home.

The proxypass seems to be working as I can see the webpage from xyz.domain.net/home, however the webpage is the ONLY thing that seems to be being proxied. All other assets such as js files or fonts are not being correctly requested.

For example, when loading https://xyz.domain.net/home this page fetches https://xyz.domain.net/scripts/index.js. However, when accessing it via the proxy URL https://my.website.com/foo/bar/home the asset is instead attempted to be retrieved from https://my.website.com/scripts/index.js and of course is responded with a 404.

Is there any other proxy directive which I must include in order for the assets loaded by the page to also be retrieved from the xyz.domain server?

As another piece of information, I've attempted ProxyPreserveHost On instead of Off but this retrieves a 403 from the end server on every page I try to access to.

I am using Oracle HTTP Server version 12.2.1.4

Thank you in advance.

in flag
Does this answer your question? [How can I forward requests from my web server?](https://serverfault.com/questions/1035016/how-can-i-forward-requests-from-my-web-server)
in flag
See the section `Backend configuration`
Ress avatar
lc flag
Hi Gerald. Which part of that section do you mean exactly? I should mention that I don't have access to the xyz server configurations
Ress avatar
lc flag
I will edit my post, but I should have been clearer, I am using OHS rather than Apache. Both `ProxyHTMLURLMap` `ProxyHTMLExtended` keywords aren't accepted. The rest of the configuration seems to be exactly as described there
in flag
You need the `mod_proxy_html` module for that. If that is not available configuring the backend with the correct URLs is the only way.
Ress avatar
lc flag
Hi Gerald. We have been able to install mod_proxy_html on the apache and load the module on httpd.conf. Is it possible to just modify the relativate path of the html using this module, just for everything after the `^/foo/bar/(.*)$` endpoints?
in flag
From reading the documentation of the module I would assume yes.
Ress avatar
lc flag
I have attempted `ProxyHTMLURLMap https://example.com/(.*)$ ^/foo/bar/$1 R` but unfortunately when the proxied page is loaded it's still trying to retrieve the assets from the `^/foo/bar` server
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.