homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Apache Reverse Proxy , URL Error
apache mod_proxy mod_html
ku1918




msg:4670925
 3:53 am on May 14, 2014 (gmt 0)

I have some error with my apache reverse proxy. Currently I am doing reverse proxy to 4 websites.

1.1.1.1/a
1.1.1.2/b
1.1.1.3/c
1.1.1.4/d

I am having no problem when reverse proxy to a and b website. Image are good and no problem.

However, when comes to c and d website. Image are not getting loaded.In my access_log , here are the logs.

- - [08/May/2014:10:40:36 +0800] "GET /whatshot_v3/images/promo/img_samplePromo.jpg HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/menu/faq_butt_03.png HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/banner/text_planprice.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/banner/text_services.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/banner/text_account.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/shortcut/bann_store.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/shortcut/bann_rewards.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/shortcut/bann_idd.gif HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/footer/img_customerService.png HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/footer/icon_fb.png HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/footer/icon_tw.png HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/footer/icon_rss.png HTTP/1.1" 404 1245
- - [08/May/2014:10:40:36 +0800] "GET /images_v3/footer/icon_share.png HTTP/1.1" 404 1245
Accessing from the apache reverse proxy server itself have no problem. When accessing from outside, the problem occur.

I have try directly typing the url in another machine and the image are loaded.

1.1.1.1 - - [08/May/2014:10:19:00 +0800] "GET **/d/images_v3/footer/icon_share.png** HTTP/1.1" 200 869 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
1.1.1.1 - - [08/May/2014:10:18:24 +0800] "GET **/images_v3/footer/icon_share.png HTTP/1.1" 404 1245** "htt://1.2.3.4/digi/landing.do" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
As you can see the link in the first one is working. The one in the second one is not.

When I request the webpage normally, it will request the second link and it will cause 404 error as cannot find the path.

If i type directly the first link , the image was found.

I notice that c and d website are redirected when type the link.And this is the cause of the problem.

1.1.1.3/c --> 1.1.1.3/c/index_other.html
1.1.1.4/d --> 1.1.1.4/d/landing.do
Here is my apache reverse proxy configuration

<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
#DocumentRoot /www/docs/dummy-host.example.com
#ServerName dummy-host.example.com
ErrorLog logs/arp_error_log
CustomLog logs/arp_access_log common

ProxyRequests Off

<Location /a>
ProxyPass http://1.1.1.1/a
ProxyPassReverse http://1.1.1.1/a
</Location>

<Location /b>
ProxyPass http://1.1.1.2/b
ProxyPassReverse http://1.1.1.2/b
</Location>

<Location /c>
ProxyPass http://1.1.1.3/index_other.html
ProxyPassReverse http://1.1.1.3/index_other.html
</Location>

<Location /d>
ProxyPass http://1.1.1.4:8080
ProxyPassReverse http://1.1.1.4:8080
</Location>

</VirtualHost>

So , how do i solve this? I have been researching mod_rewrite and mod_proxy_html , but no luck in solving the problem.

[edited by: phranque at 4:27 am (utc) on May 14, 2014]
[edit reason] unlinked urls in code [/edit]

 

lucy24




msg:4670931
 4:22 am on May 14, 2014 (gmt 0)

Wait. Are you using the numerical IP as the actual hostname? Or did you change that for posting purposes? (You can use multiple names in Forums as needed: example.com, example.org, example.net, example.xyz...) Do the quoted logs combine all four hostnames into a single file, or are those the logs for just one of your four?

This is your own server, right? What comes up if you run a RewriteLog set to a fairly high logging level?

phranque




msg:4670934
 4:35 am on May 14, 2014 (gmt 0)

welcome to WebmasterWorld, ku1918!


if you check your web server error log files it should tell you what path it's looking for and not finding which may help you find the problem.

regarding index_other.html you might want to use RewriteCond and RewriteRule with the [P] flag to make this work.

regarding landing.do i would look for additional server directives perhaps on the proxy server.

ku1918




msg:4670936
 5:30 am on May 14, 2014 (gmt 0)

There are no error in my web server log. The only log is the log that I have posted in my post which is from the access_log. All the logs are the combine logs in a single file.

How i would like to use RewriteCond and RewriteRule.I still inexperience with mod_rewrite.

One thing i know how to solve the problem is to add the /d/ path in front of GET /images_v3/footer/icon_share.png HTTP/1.1" 404 1245

Looking for advice here.

lucy24




msg:4670958
 9:40 am on May 14, 2014 (gmt 0)

There are no error in my web server log.

You may need to increase the logging level. Error logs can be made to show pretty much anything in the 4xx/5xx class; the default setting is near the middle of the range. The terminology is a little misleading, because the directive
LogLevel
refers to error logs, not to the ordinary access logs. You probably don't need "debug", but if the server hasn't gone live yet, it won't do any real harm.

RewriteLogs are a little tricky. But unlike error logs, levels are identified by number, so you don't have to figure out whether "notice" comes before or after "info". (Really. They expect anyone to remember this stuff?)

How much experience did you have with Apache before you started running your own server? Some things can only be done in the config file, but most aspects of mod_rewrite can be learned even if you're limited to htaccess in shared hosting. It sounds as if you're learning everything at once :(

One thing i know how to solve the problem is to add the /d/ path in front of GET

Yes, that's your clue that something is misbehaving, because it shouldn't be necessary-- and obviously won't be possible once you're in production. You can't go around redirecting every single request just because you and the server speak different languages.

What have you got going with mod_alias? Your original question was about proxies, but it seems as if there ought to be some aliasing involved too.

ku1918




msg:4670961
 10:09 am on May 14, 2014 (gmt 0)

I only have around 3-4 months of Apache experience. You are right as I am trying to learn everything at once.

Yes.It is about Reverse proxying.

I have not gone through with mod_alias.I will look into it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved